I know they say that dogs don't do that for spite but sometimes I wonder.
I will never forget the one and only time my little Casper peed on my bed. We had started out for a walk (he was still a puppy and loved his walks) but we got sidetracked by a group of little girls that wanted to hold and pet him. And I let them. End result, we had time only to head back home.
Got home - and he peed on the bed. Guess I know what he thought about THAT walk!

Or, it could be that he just didn't get a chance to pee!
It never happened again and hopefully yours won't either.