Sunan an-Nasa'i, Book 46, Hadith 3 (In-Book)

It was narrated that Abu Hurairah said: "No one who commits Zina is a believer at the moment when he is committing Zina; no one who steals is a believer at the moment when he is stealing; no one who drinks wine is a believer at the moment when he is drinking it." - And he mentioned a fourth but I (the narrator) have forgotten it - "When he does that the yoke of Islam is shed from his neck, but if he repents, Allah accepts his repentance."

أَخْبَرَنَا مُحَمَّدُ بْنُ يَحْيَى الْمَرْوَزِيُّ أَبُو عَلِيٍّ، قَالَ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ عُثْمَانَ، عَنْ أَبِي حَمْزَةَ، عَنْ يَزِيدَ، - وَهُوَ ابْنُ أَبِي زِيَادٍ - عَنْ أَبِي صَالِحٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ لاَ يَزْنِي الزَّانِي حِينَ يَزْنِي وَهُوَ مُؤْمِنٌ وَلاَ يَسْرِقُ وَهُوَ مُؤْمِنٌ وَلاَ يَشْرَبُ الْخَمْرَ وَهُوَ مُؤْمِنٌ وَذَكَرَ رَابِعَةً فَنَسِيتُهَا فَإِذَا فَعَلَ ذَلِكَ خَلَعَ رِبْقَةَ الإِسْلاَمِ مِنْ عُنُقِهِ فَإِنْ تَابَ تَابَ اللَّهُ عَلَيْهِ ‏.‏

sunnah.com