Spraying is how dogs mark their territory. It tells other dogs -- and sometimes wildlife as well -- that he lives there and that they should stay away. Marking is also a sexual behavior. It lets other dogs know your boy has been here and that he's available for mating. Marking is not the same as just urinating, though unlike some other animals, the substance they spray is indeed urine. When a dog "sprays," he urines little streams in many different places. You might come home and find Rover sprayed your couch, your bed, walls and the kitchen table legs.
Have Doggie spayed or neutered. Since spraying is at least partly a sexual behavior, eliminating the sexual urge is likely to cure it. Although males are more likely to spray than females, females will also do it, especially if they share the home with another cat --- they're trying to impose their scent around, sending the message that they're the "top dog" of the house.
Respect the ranks the dogs have establish for themselves. If the dogs have decided that Rover is top dog, you need to respect that by feeding, petting and talking to Rover first -- all other dogs in the house come after. If you don't respect the ranks, Rover might be tempted to remind everybody who's the boss by spraying his scent around.
Help Doggie feel more secure, especially if he tends to spray when he's alone. Separation anxiety can lead to some dogs spraying their own territory as a way to keep "invaders" away -- especially when you're leaving him alone or he's feeling lonely and scared. If your dog is crate-trained, put him in his crate when you leave. Or you can try locking him in one room of the house -- smaller spaces make dogs feel safer than a huge lonely house.
Build a fence to keep stray dogs away from your property. If you don't protect your own yard from strange dogs, Rover might be tempted to do it himself by spraying all around your garden and yard.
Teach Doggie to see you as the boss. Lack of training might send the signal that you're not the pack leader and it's therefore okay for him to spray to mark his territory -- "his" territory, not yours. To change that perception, Paw Rescue recommends teaching Doggie basic commands such as "Sit," and using one for everything. If he wants to eat, make him sit first; if he wants to go for a walk, make him sit first. A well-trained dog is less likely to misbehave and to spray.