If the dog soils itself or smells bad, it should be bathed as soon as possible. The point is to keep the dog free of the smell of its own filth. The more you do this, the sooner the dog will become UNaccustomed to the smell, and it will become something it doesn't want to live with. Clip on a leash, take the dog for a quick walk, praising lavishly any elimination. Then bathe the dog.
Dogs are very, very good at reading body language.
This whole process that I have described shows the dog, through your body language, that the smell of body wastes is to be avoided. Some dogs haven't figured out how to ask to go out. They are probably giving you subtle body language that you don't or can't see. In the other, the dog is not hiding from you, as you might think, but keeping it as far as possible away from the main living area, in an effort to be clean. Hang some kind of bell from the doorknob, at the dog's nose level.