This is actually pretty common. Dogs do not generalize well so a dog who's been housetrained doesn't initially automatically make the connection that the "no peeing in the house" rule applies to all buildings everywhere, and cars too. So when going places outside the home with a recently housetrained dog, you have to step back and go back to the stuff you used to do when you were first housetraining--supervise constantly or crate when you can't do that, more frequent trips outside, etc.... Once a dog gets this treatment in a few different places and becomes hosuebroken for those places as well, it gets a lot easier for them to generalize the rule and it does click that their housetraining means anywhere inside, but it takes doing the training over in a few different places before they make the connection usually.
For Marlowe, he first got the rule down at our house, but it took more time for him to generalize that to the car (pee in the car=not good!!!), and also to the pet store and to other peoples' houses. But once he got the car and the pet store and our inlaws' house down, he pretty much was able to take it from there.
Cressida and her best friends:
