Sahih Muslim | Book 3 | Chapter 28

Narrated by Abu Huraira
Abu Huraira reported that he met the Apostle of Allah (may peace be upon him)on one of the paths leading to Medina in a state of (sexual) defilement and he slipped away and

took a bath. The Apostle of Allah (may peace be upon him) searched for him and when he came, he said to him: O Abu Huraira, where were you? He said: Messenger of Allah, you met when I was (sexually) defiled and I did not like to sit in your company before taking a bath. Upon this the Messenger of Allah (may peace be upon him) said: Hallowed be Allah, verily a believer is never defiled.

Narrated by Hudhaifa
Hudhaifa reported: The Messenger of Allah (may peace be upon him) happened to meet him and he was (sexually) defiled, and he slipped away and took a bath and then came and said: I was (sexually) defiled. Upon this he (the Holy Prophet) remarked: A Muslim is never defiled.