One of the unique characteristics of the Prophet (peace and blessings of Allah be upon him) was that it was permissible for him to be alone with a non-mahram woman and look at her
Question

 
I have heard that there is consensus among the ummah that the Messenger of Allah (peace and blessings of Allah be upon him) was considered to be a mahram for every Muslim woman, when Allah commanded him in His Book (interpretation of the meaning): 
“It is not lawful for you (to marry other) women after this, nor to change them for other wives even though their beauty attracts you” [al-Ahzaab 33:52] 
Thus Allah forbade him to marry any woman (from point onwards). Did he thereby become a mahram in the sense that it was permissible for women to uncover in front of him like any other mahram? And did the Messenger of Allah (peace and blessings of Allah be upon him) stay overnight in the houses of the Muslims because he was a mahram to their womenfolk?.
Praise be to Allah.Many scholars are of the view that one of the unique characteristics of the Prophet (peace and blessings of Allah be upon him) was that he was permitted to be alone with the women of his ummah and to look at them and let them ride behind him on his mount. 
Al-Hattaab al-Maaliki said: One of his unique characteristics was that he was allowed to be alone with a non-mahram woman, as was narrated by al-Damaameemi in his commentary on al-Bukhaari, at the beginning of the Book of Jihad, where it speaks of his entering upon Umm Haraam bint Milhaan. Shaykh Jalaal al-Deen says in al-Mubaahaat: It was one of his unique characteristics that he was permitted to be alone with them and to let them ride behind him on his mount. 
End quote from Mawaahib al-Jaleel, 3/402. 
Al-Bujayrami al-Shaafa’i said in his commentary on al-Khateeb: He (peace and blessings of Allah be upon him) had the unique characteristic of being allowed to look at non-mahram women and to be alone with them and to let them ride behind him on his mount, because he was protected by his infallibility. This is the correct answer concerning the story of Umm Haraam and how he entered upon her and slept in her house and she cleaned his head, even though they were not mahrams or spouses. With regard to the suggestion that she was his mahram through radaa’ah (breastfeeding), this was refuted by al-Dimyaati on the grounds that it cannot be proven. 
End quote from Haashiyat al-Bujayrami, 3/372. 
Commenting on the hadeeth of al-Rubayyi’ bint Mu’awwidh ibn ‘Afra, who said: The Prophet (peace and blessings of Allah be upon him) came and entered when it was my wedding and sat by my bed like you are sitting next to me now, and some young girls of ours started to beat the daff and eulogize about those of my forefathers who were killed on the day of Badr. When one of them said, “There is among us a Prophet who knows what will happen tomorrow,” he said, “Do not say this, but say the other things you were saying” (Narrated by al-Bukhaari, 4750), 
Al-Haafiz ibn Hajar said: What is clear to us on the basis of strong evidence is that one of the unique characteristics of the Prophet (peace and blessings of Allah be upon him) is that it was permissible for him to be alone with a non-mahram woman and to look at her. This is the correct answer concerning the story of Umm Haraam and how he entered upon her and slept in her house and she cleaned his head, even though they were not mahrams or spouses.  
End quote from al-Fath, 9/303 
Many of the scholars were of the view that Umm Haraam was one of the mahrams of the Prophet (peace and blessings of Allah be upon him); al-Nawawi even narrated that there was consensus among the scholars on this point. 
It says in Mataalib Ooli al-Nuha (5/34) – one of the Hanbali books: It was permissible for him to let a non-mahram woman ride behind him on his camel, because of the story of Asma’. And Abu Dawood narrated from a woman of Ghifaar that the Prophet (peace and blessings of Allah be upon him) let her ride behind him on the back of his camel saddle. And it was permissible for him to be alone with them because of the story of Umm Haraam. 
The hadeeth of Asma’ referred to above was narrated by al-Bukhaari (4823) and Muslim (4050) from Asma’ bint Abi Bakr (may Allah be pleased with them both), who said: I used to bring the date-stones from the land of al-Zubayr that the Messenger of Allah (peace and blessings of Allah be upon him) had allocated to him, (carrying them) on my head, and it was two-thirds of a farsakh (a farsakh = three miles) away. I came one day with the date-stones on my head, and I met the Messenger of Allah (peace and blessings of Allah be upon him), and a group of the Ansaar were with him. He called me then made his camel kneel down so that I could ride behind him, but I felt too shy to travel with the men, and I remembered al-Zubayr and his protective jealousy (gheerah), for he was the most jealous of people. The Messenger of Allah (peace and blessings of Allah be upon him) realized that I felt too shy so he went on his way. Then I came to al-Zubayr and told him that I had met the Messenger of Allah (peace and blessings of Allah be upon him) carrying the date-stones on my head, and there was a group of his companions with him, and he had made his camel kneel so that I could ride behind him, but I had felt too shy and I remember his (al-Zubayr’s) protective jealousy. He said: “By Allah, for you to have to carry the date-stones is harder for me to bear than your riding with him.” She said: Then later on Abu Bakr sent me a servant to take care of the horse and it was as if I had been set free from slavery. 
The hadeeth of the woman from Ghifaar was narrated by Abu Dawood (313) from that woman of Banu Ghifaar who said: The Messenger of Allah (peace and blessings of Allah be upon him) let me ride behind him on the back of his camel-saddle. This was classed as da’eef by al-Albaani in Da’eef Abi Dawood.  
This is not one of the issues on which the scholars are unanimously agreed, rather some of them clearly stated that there was a difference of scholarly opinion on this point. Al-‘Iraaqi said in Tarh al-Tathreeb (5/167), concerning the Prophet (peace and blessings of Allah be upon him) entering upon Dubaa’ah bint al-Zubayr: He (peace and blessings of Allah be upon him) entered upon Dubaa’ah to visit her when she was sick or to visit her because she was his relative as stated above. This points to his humility, upholding of kinship ties and concern for his relatives. It is to be interpreted as meaning that he was not alone with a woman in this case, because he (peace and blessings of Allah be upon him) did not sit alone with non-mahram women or shake hands with them. If he did do that then this does not mean that his infallibility was tarnished thereby, but they did not regard that as being one of his unique characteristics, thus he is like others with regard to this issue. 
And Allah knows best.