Hadith That Allah Will Not Forgive A Person Committing Sins Openly
Following is the complete Hadith that you’re referring to: https://sunnah.com/bukhari:6069 It is referring to the same atttitude of open rebellion (Istakbar/Sarkashi) against God for which it is mentioned in Quran that: إِنَّ الَّذِينَ كَذَّبُواْ بِآيَاتِنَا وَاسْتَكْبَرُواْ عَنْهَا لاَ تُفَتَّحُ لَهُمْ أَبْوَابُ السَّمَاء وَلاَ يَدْخُلُونَ الْجَنَّةَ حَتَّى يَلِجَ الْجَمَلُ فِي سَمِّ الْخِيَاطِ وَكَذَلِكَ نَجْزِي الْمُجْرِمِينَ لَهُم مِّن جَهَنَّمَ مِهَادٌ وَمِن فَوْقِهِمْ غَوَاشٍ وَكَذَلِكَ نَجْزِي الظَّالِمِينَ Indeed those who denied Our revelations and evaded them in arrogance, the gates of heavens shall not be opened for them and neither shall they be able to enter Paradise except if a camel is able to pass through the eye of a needle. [This is their punishment] and in this manner do We punish the criminals. Hell shall be their bedding and [the flames of] Hell shall be their covering and in this way do We punish the evil-doers . (7:40-41)