كتاب الأشربة
36  
The Book of Drinks
(19)
Chapter: What the guest should do if he is accompanied by someone who was not invited by the host; it is recommended for the host to give permission to the one who has accompanied the guest
(19)
باب مَا يَفْعَلُ الضَّيْفُ إِذَا تَبِعَهُ غَيْرُ مَنْ دَعَاهُ صَاحِبُ الطَّعَامِ وَاسْتِحْبَابُ إِذْنِ صَاحِبِ الطَّعَامِ لِلتَّابِعِ
Sahih Muslim 2037

Anas reported that:

Allah's Messenger (ﷺ) had a Persian neighbour who made excellent soup. He prepared some for Allah's Messenger (ﷺ) and then came to him to invite him to eat. He (Allah's Messenger) said, "and her too," referring to `Aisha. The man said "No," so Allah's Messenger (ﷺ) then said "No." He returned later to invite him again, so Allah's Messenger (ﷺ) said "and her too." The man said "No," so Allah's Messenger (ﷺ) then said "No." He returned another time to invite him and Allah's Messenger (ﷺ) said, "and her too." The man said yes on this third occasion, and they then stood eagerly to go out together to the man's home.
وَحَدَّثَنِي زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، أَخْبَرَنَا حَمَّادُ بْنُ سَلَمَةَ، عَنْ ثَابِتٍ، عَنْ أَنَسٍ، أَنَّ جَارًا، لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَارِسِيًّا كَانَ طَيِّبَ الْمَرَقِ فَصَنَعَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم ثُمَّ جَاءَ يَدْعُوهُ فَقَالَ ‏"‏ وَهَذِهِ ‏"‏ ‏.‏ لِعَائِشَةَ فَقَالَ لاَ ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لاَ ‏"‏ فَعَادَ يَدْعُوهُ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ وَهَذِهِ ‏"‏ ‏.‏ قَالَ لاَ ‏.‏ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لاَ ‏"‏ ‏.‏ ثُمَّ عَادَ يَدْعُوهُ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ وَهَذِهِ ‏"‏ ‏.‏ قَالَ نَعَمْ ‏.‏ فِي الثَّالِثَةِ ‏.‏ فَقَامَا يَتَدَافَعَانِ حَتَّى أَتَيَا مَنْزِلَهُ ‏.‏
Reference : Sahih Muslim 2037
In-book reference : Book 36, Hadith 186
USC-MSA web (English) reference : Book 23, Hadith 5054
  (deprecated numbering scheme)