<human>: Can you provide a brief rundown of the text in within 3 sentences?

I've never potty trained a dog before, and I'm sure this is where my problems are coming from.

A few months ago I "rescued" a little black schnauzer, two years old, from the humane society. He had previously been a stray, was taken in for a few months and returned. Apparently he was pee-pad trained. I don't want to use pee-pads so I have never bought any. I've got him to the point where he will not go to the bathroom with us in the room no matter what (except emergencies), even when we are asleep, which is great.

The problem comes in when we leave him somewhere alone for under five minutes. Like in the morning when I get up to take a shower, and my wife is getting ready for work, we leave him in the bedroom alone for ten minutes so he doesn't wander the house a pee somewhere we won't find. 50% of the time he will not do anything and remain in bed. The other 50% he goes poo and pee. 

Our other dog has no problems whatsoever with holding it (also a rescue). We leave her out all day and have no messes. I'd like to get to this point with my other dog, but I'm not sure what I'm doing wrong. It should also be noted that when we aren't home we leave him in his kennel and he holds it.

When he does go in the house, he immediately hides. With this behavior, I know that he knows that what he did was wrong. Whenever we find his messes (and it's recent enough) we scold him with "No, bad boy!" and lightly spank him. I'd really like to correct this problem. We can't let him wander the house because of it. He'll try to get away and go somewhere where we aren't present so now he *always* has to be with us. I'd like him be able to wander the house without having to worry about where he is going to go. Thanks for any advice you can offer.
<bot>: My male dog is potty trained when we watch him, but if he is alone for 5 minutes he will go. How do I fix this?