The Messenger of Allah ﷺ said, "Whoever is invited should accept the invitation. Then, if he wishes, he may eat, and if he wishes, he may decline."
حدثنا محمد بن كثير أخبرنا سفيان عن أبي الزبير
قال رسول الله ﷺ من دعي فليجب فإن شاء طعم وإن شاء ترك
Muslim narrated it in the Book of Marriage, chapter "The Command to Accept an Invitation to a Feast," hadith no. 1430, from the hadith of Sufyan through this route.