Note -- I am not asking about the whether one is allowed to pray near a bathroom in this sense.
As per the rules on this website, thinking Torah thoughts is not allowed in a bathroom. As such, would I be wrong to say any sort of prayer near a bathroom that is occupied by someone who would hear what I am saying? If I know that the person would listen to my bracha (for example) and say Amen to it then I would be causing the person to think about Torah while in an inappropriate location, and my actions create a michshol.
This is a question about theory though it has practical roots as many kitchens have a powder room and if someone goes to the bathroom while someone else gets food (or washes for bread etc) and can hear the bracha being said, he would respond, or at least think of the halachot of brachot.