Assuming your dog is indeed trying to urinate, there are several causes.
It can be a urinary tract infection, bladder stones or a tumor.
Infection and stones are the most common causes.
A couple articles that might be helpful to you are Urinary Tract Infections in Dogs and Urolithiasis in Dogs.