What worked for me was just to carefully watch and discourage him from doing it. Clyde would always give clues such as: excessive sniffing at one spot, slowing down his gait and getting really close to the object he was about ready to pee on. Your dog might have different cues, but they all usually have some. As soon as I would see him do it, I would do a correction tone that I use with him which is a loud "EH!!" and then make him go outside.
I didn't always catch him in time (he was a ninja marker), so I always let the people know as soon as we came in that there was a chance he would do it. This usually wasn't a problem as we would just take him to other dog friendly houses.
Is he neutered or has he recently been neutered? Clyde was 2 years old when we got him and was just neutered a month before. About 6 months post neuter, his marking inside (with our corrections) stopped completely.