كتاب التوبة
50  
The Book of Repentance
(2)
Chapter: Sins Are Erased By Praying For Forgiveness And Repenting
(2)
باب سُقُوطِ الذُّنُوبِ بِالاِسْتِغْفَارِ تَوْبَةً ‏‏
Sahih Muslim 2748 a

Abu Sirma reported that when the time of the death of Abu Ayyub Ansari drew near, he said:

I used to conceal from you a thing which I heard from Allah's Messenger (ﷺ) and I heard Allah's Messenger (ﷺ) as saying: Had you not committed sins, Allah would have brought into existence a creation that would have committed sin (and Allah) would have forgiven them.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا لَيْثٌ، عَنْ مُحَمَّدِ بْنِ قَيْسٍ، - قَاصِّ عُمَرَ بْنِ عَبْدِ الْعَزِيزِ - عَنْ أَبِي صِرْمَةَ، عَنْ أَبِي أَيُّوبَ، أَنَّهُ قَالَ حِينَ حَضَرَتْهُ الْوَفَاةُ كُنْتُ كَتَمْتُ عَنْكُمْ شَيْئًا سَمِعْتُهُ مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ لَوْلاَ أَنَّكُمْ تُذْنِبُونَ لَخَلَقَ اللَّهُ خَلْقًا يُذْنِبُونَ يَغْفِرُ لَهُمْ ‏"‏ ‏.‏
Reference : Sahih Muslim 2748a
In-book reference : Book 50, Hadith 11
USC-MSA web (English) reference : Book 37, Hadith 6620
  (deprecated numbering scheme)