The unlawful seclusion (khalwa) in Islamic law is defined as a situation where a man and a woman who are not maḥrams are hidden from public view without any oversight or impediment.
Oversight includes any means that can monitor the two individuals, such as a person or a surveillance device. For instance, a man and a woman could be in the same space without a third person, but if there is a camera monitoring their movements, this is not considered seclusion.
An impediment is something that prevents the commission of forbidden acts, such as illness. For example, a female doctor or nurse who is alone with a male patient in a room is impeded from forbidden acts due to the presence of the illness. Similarly, a man’s incapacity or disability, like blindness, serves as an impediment, as evidenced by the story of Fāṭimah bint Qays.
Therefore, teaching driving usually takes place in open areas and on public streets where people are constantly passing by. Thus, it does not involve the type of prohibited seclusion mentioned.