Translation
(82) Divine Will (Al-Qadar)
كتاب القدر
(13) Chapter: Refuge with Allah from having an evil end of the worldly life and having a bad fate
(13) بَابُ مَنْ تَعَوَّذَ بِاللَّهِ مِنْ دَرَكِ الشَّقَاءِ وَسُوءِ الْقَضَاءِ
Sahih al-Bukhari 6616 

Narrated Abu Huraira:

The Prophet (ﷺ) said, "Take refuge with Allah from the difficulties of severe calamities, from having an evil end and a bad fate and from the malicious joy of your enemies."

حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا سُفْيَانُ، عَنْ سُمَىٍّ، عَنْ أَبِي صَالِحٍ، عَنْ أَبِي هُرَيْرَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ تَعَوَّذُوا بِاللَّهِ مِنْ جَهْدِ الْبَلاَءِ، وَدَرَكِ الشَّقَاءِ، وَسُوءِ الْقَضَاءِ، وَشَمَاتَةِ الأَعْدَاءِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6616
In-book reference : Book 82, Hadith 22
USC-MSA web (English) reference : Vol. 8, Book 77, Hadith 613
  (deprecated numbering scheme)