I hear this question frequently and sometimes it's me who notices the odour myself when the dog and owner are enclosed in my exam room. Sometimes I catch a whiff of my own dog from the back seat of my Jeep. Everyone that has dogs knows that occasionally there are… well, odours.
Not all smells are abnormal. When I was in university, I knew a guy who told me that he had adopted a Labrador Retriever because they are the only breed of dog that has no odor, but realistically speaking, all dogs have some scent. Dogs depend on smells for much of their communication so it is expected that they will have personal odors, whether we can detect them or not. Some breeds in my experience are more pungent naturally, especially if they are heavy coated. These aromas are normal for dogs.
Sometimes dogs smell bad because of behaviors that they engage in. They may encounter a skunk or find something smelly to roll in. If they dig up old chew bones and chew on them, they may smell foul for a time, but these normal behavioral associated stinks are usually transient. In these cases, sometimes they just need a good bath. Some people say that dogs are trying to cover up their own scent by engaging in these stinky habits, but I think it may be similar to why they eat grass Some things are just fun to do.
There are also odours that are not normal, so if you notice a new and foul odour from your dog, you need to investigate.
Health issues tend to cause persistent odours. Some examples of medical related odours include: ear infections, skin disease, anal gland disease, dental disease and urinary tract issues.
A dog with a skin infection will typically show more signs of problems than just a bad all-over odor, but sometimes the smell is the first sign. A dog with allergic disease and secondary skin infection will have a distinctive, almost sweet (but repugnant) odor from the oils in his skin becoming rancid from bacterial action. You might notice thinning hair, flaking skin and redness/itching in addition to odor. Skin infections will require a veterinarian to prescribe medications to address the primary issue and many times secondary issues also. Itchy infected skin is no picnic, so seek help from your vet.