Are you talking about your dog marking with urine or with anal gland fluid? The urine will come from his penis. If this is dark and has a bad smell, it's possible your dog has an infection. In that case, he should be seen by your veterinarian. If the foul-smelling substance is coming from his anus, that's secretion from his anal glands and its purpose is to mark the territory.
However, if he does a lot of marking, it would be better to limit him to your yard so that he doesn't have so much territory to mark and protect. The more a dog marks, the less confidence that dog has and the more stressed the dog is. Because stress hormones can undermine the immune response, this could set your dog up for medical as well as behavioral problems.
NOTICE: The information provided on this site is not a substitute for professional medical advice,
diagnosis, or treatment. Never delay or disregard seeking professional medical advice from your
physician or other qualified health provider because of something you have read on Wellsphere.
If you have a medical emergency, call your doctor or 911 immediately.