Mishkat al-Masabih 2078
وَعَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: إِذَا دُعِيَ أَحَدُكُمْ إِلَى طَعَامٍ وَهُوَ صَائِمٌ فَلْيَقُلْ: إِنِّي صَائِمٌ . وَفِي رِوَايَةٍ قَالَ: «إِذَا دُعِيَ أَحَدُكُمْ فَلْيُجِبْ فَإِنْ كَانَ صَائِمًا فَلْيُصَلِّ وَإِن كَانَ مُفطرا فيطعم» . رَوَاهُ مُسلم
From Abu Hurayrah, may Allah be pleased with him, who said: The Messenger of Allah ﷺ said: "When one of you is invited to food while he is fasting, let him say: 'I am fasting.'" In another narration he said: "When one of you is invited, let him accept. If he is fasting, let him pray [for them], and if he is not fasting, let him eat." Reported by Muslim.