The Prophet ﷺ was in a tent on the day of Badr when he made the supplication that was mentioned.
أن النبي ﷺ قال وهو في قبة يوم بدر، فذكر الدعاء.
No references are available.
Bukhari narrated it in the tafsir (4877) from Ishaq (Wasiti), who said, "Khalid (that is, Tahhan) narrated to us," from Khalid (that is, Hadhdha), from Ikrima, from Ibn Abbas, and he mentioned the hadith in full, and it is mentioned in the account of his ﷺ supplication on the day of Badr.It is narrated that Saad bin Muaz said to the Messenger of Allah ﷺ when the two sides met on the day of Badr, "O Messenger of Allah, shall we build you a shelter so that you may stay in it, and have your mount made to kneel there for you, while we meet our enemy? If Allah grants us victory over them and fulfills our hope, that is what we would love most. But if the other outcome comes to pass, you can mount your ride and join those of our people who are behind us, for by Allah, there are people who have stayed behind who do not love you any less than we do. Had they known we would meet in battle, they would not have stayed behind. They love you and would support you." The Messenger of Allah ﷺ praised him for this and prayed for him, so a shelter was built for the Messenger of Allah ﷺ, and he stayed in it with Abu Bakr , with no one else besides the two of them.Bayhaqi narrated it in the Dalail (3/44) through the route of Muhammad bin Ishaq, who said, "Abdullah bin Abu Bakr bin Hazm narrated to us that Saad bin Muaz said to the Messenger of Allah ﷺ," and he related it.It is also found in Sirat bin Hisham (1/620), where Ibn Ishaq said, "Abdullah bin Abu Bakr narrated to me that it was reported that Saad bin Muaz said," and he related it. This is mursal. It also does not mention that Abu Bakr was with him in this shelter, nor that no one else was with the two of them.