You can't really stop a dog from marking its territory, but if you really dont want them to you have to make them leave the place they are marking it. As easy as that.
It is impossible. The sad truth is that many behaviours that we want to stop in our dogs is just their natural instinct. Many behaviours can be managed, if your pet is marking inside the house it...
If you have another dog he will try to mark his or her before the other, it you house is dusty it smells like outside dirt and they smell it and they mark as close as they can by were they smell it