Sunan an-Nasa'i, Book 35, Hadith 12 (In-Book)

It was narrated from 'Abdullah bin Buraidah that his father said: "The Messenger of Allah said: 'Whoever says: I have nothing to do with Islam, if he is lying then he is as he said, and if he is telling the truth, his Islam will not be sound.'"

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

sunnah.com