Praise be to Allah, and blessings and peace be upon the Messenger of Allah. To proceed:
Firstly:
The Messenger (blessings and peace of Allah be upon him) forbade a man to be alone with a woman who is a stranger (non-mahram) to him, as he (blessings and peace of Allah be upon him) said: “No man should be alone with a woman unless her mahram is present.” Narrated by al-Bukhari (5233).
He (blessings and peace of Allah be upon him) also said: “No man is alone with a (non-mahram) woman but the Shaytan is the third one present.” Narrated by at-Tirmidhi (2165); classed as sahih by al-Albani in Sahih Sunan at-Tirmidhi, no. 2165.
This being alone with a woman is something that happens frequently with taxi drivers. The driver often needs to drive on minor streets where there are no passers-by, or in isolated places, such as on the outskirts of cities. Even if there is no driving in isolated areas, meaning that he is driving in the city on streets that are crowded with people, the fact that the driver is with the woman on her own may tempt him to look at her in unlawful ways, and that could be a means that leads to falling into what is prohibited. If something leads to what it is prohibited, it is also prohibited.
Al-Qarafi (may Allah have mercy on him) said: Means come under the same ruling as ends. Therefore the means that leads to something that is prohibited is also prohibited, and the means of doing something that is obligatory is also obligatory; the same applies to all other rulings.(Al-Furooq, 3/200).
Ibn al-Qayyim (may Allah have mercy on him) said:
Because objectives cannot be attained except through the means and ways that lead to that, the ways and means come under the same ruling as the objectives. So the means that lead to unlawful actions and sins, and whether they are deemed to be disapproved or disallowed, depends on whether they lead to those goals… If the Lord, may He be Exalted, has prohibited a thing and there are ways and means that could lead to it, then He has also forbidden [those ways and means], so as to uphold the prohibition and ensure that it is heeded, and to prevent anyone from approaching it. If He permitted the ways and means that lead to the prohibited action, that would contradict the prohibition and tempt people to commit that deed, and His wisdom and knowledge could never allow that.(I`laam al-Mawaaqi`in, 4/553).
It says in Fatawa al-Lajnah ad-Da’imah, 17/57:
What is meant by the being alone with a member of the opposite sex that is prohibited in Islamic teaching is not only a man being alone with a non-mahram woman in a remote house, far from people’s gaze. Rather it includes his being alone with her in a place where they can converse and chitchat, even if that is where people can see them without hearing what they are saying, whether that is in an open space or in a car or on the roof of a house and the like. That is because their being alone together is prohibited as it is a means that could lead to zina, so anything that could come under this heading comes under the same ruling as being physically alone with her in a place far from people’s gaze. End quote.
Secondly:
You should try hard to keep away from this prohibited action, and excuse yourself by whatever means you can.
If you cannot do that and it is too difficult for you, then try hard to take a route inside the city, whenever that will help to keep you further away from this trouble, because it is safer than falling into what is prohibited.
If that is not possible, or your livelihood will be affected by changing where you work, and you feel that you may be harmed by refusing to accept female passengers, then we hope that there will be no blame on you for letting them ride in your car, so as to ward off harm from you. Allah, may He be Exalted, says (interpretation of the meaning): {He has explained to you in detail what is forbidden to you, except if you are forced by necessity} [al-An`am 6:119].
But you must not let her sit beside you; rather she should sit in the back seat, as passengers usually do. And you must avoid looking at her or talking to her, except for what is necessary.
If this happens a great deal and you can find other work in which there is nothing prohibited and there are no reservations concerning it, then that will be better for you.
We ask Allah to grant us and you lawful provision.
And Allah knows best.