YOU might do that at a mosque. I have been inside the Dome of the Rock, and you can believe that I did not pray to the Muslim (faux) god.
The physical setting does not determine to whom one prays, does it? Then what about people in Auschwitz? Could they not pray to the Living God who was present in the midst of all that darkness?
I read that the Pope did not remove his shoes in the mosque, nor did he pray, but he remained quiet.
...there’s a huge difference between praying to your God for deliverence when you’re a forced prisoner in a death camp, and voluntairly going to another religion’s house of worship and praying (which the Pope did not do).