Short Answer
It is not allowed for a man and woman to be alone together in a room. If they need to be in a room alone together for some need such as a doctor’s consultation, then keep the door open so you are not alone in private so someone could walk by and see you. If the door must be closed then choose a room with a window so people can look in and it is not considered private. If none of that is possible and there is a real need to be alone, such as a doctor having a private consultation, then it is allowed. If a Muslim is able to choose a doctor of the same gender, then that is a must to avoid such situations.
What the Qur’an and Sunnah Say
The Messenger of Allah said: “A man must not remain alone in the company of a woman…” (Bukhari #2488)
He also said “A man and woman do not remain alone in privacy except that the third amongst them Satan.” (Tirmidhi #2165)
What the Scholars Said
Imam Ibn Nujaym stated a well-known principle in Islamic Law: “Cases of need are restricted to the actual need” (Al-Ashbah wa n-Naza’ir, 86)
Version 0.25
Shaykh Mustafa Umar