Praying in a graveyard: It was narrated from Abū Sa’īd that the Prophet (May Allāh praise him and Peace be upon him) said, “The whole Earth is a place for prayer, except bathrooms and graveyards.” [Authenticated by Sheikh Al Albānī in Al Irwā` 287].
Sheikh Al Islam Ibn Taimiyyah said, “It is not correct to pray in a graveyard or with one in front of you, and this prohibition is purely to close the door to shirk (associating partners with Allāh)” [Tamām Al Minnah p.298].
Bathroom: It was narrated from Abū Sa’īd Al Khudrī (may Allāh be pleased with him) that the Prophet (May Allāh praise him and Peace be upon him) said, “The whole Earth is a place for prayer, except bathrooms and graveyards.” [Reported by Imams Aḥmad and Tirmidhī with an authentic chain of narration).