The Messenger of Allah ﷺ said, "If any of you is invited to a meal while he is fasting, let him say, 'I am fasting.'"
حدثنا مسدد حدثنا سفيان عن أبي الزناد عن الأعرج
قال رسول الله ﷺ إذا دعي أحدكم إلى طعام وهو صائم فليقل إني صائم
Muslim narrated it in Sawm, chapter on the recommendation for one who is fasting, if invited to a meal, etc., no. 1150, from the hadith of Sufyan bin Uyayna, through the same chain.