The World Federation One Stop Fiqh

Ruling 875

It is unlawful for a man and a woman who are not maḥram23 to be in a secluded place together if there is a probability of a sin taking place. And the recommended precaution is that prayers should not be performed there.

23 A maḥram is a person whom one is never permitted to marry on account of being related to them in a particular way; for example, by being their parent or sibling.