Can I Pray in Public With a Man Who Is Not Related to Me?
Hanafi Fiqh
Answered by Ustadh Salman Younas
Question: As a woman, is it permissible to pray with a non-mahram man when it is just the two of us and we are in a public area (not secluded) but relatively empty?
Answer: assalamu alaykum
The basis is that such a prayer would be valid and permitted in light of it being in a public place provided the interaction between the two individuals is appropriate and adheres to Islamic norms of gender interaction. [Ibn Abidin, Hashiya (1:381)]
With this said, it may still be best to avoid this unless there are other factors involved, such as concern for safety in public when praying alone or the like.
Checked & Approved by Shaykh Faraz Rabbani.