שולחן ערוך, יורה דעה שס״ה

Shulchan Arukh, Yoreh De'ah 365

החופר קבר פטור מק"ש וכמה מרחיקין הקברות מהעיר. ובו ב' סעיפים:
החופר כוך למת פטור מקריאת שמע ומן התפלה ומן התפילין ומכל מצות האמורות בתורה ואם הם שנים והגיע זמן ק"ש אחד עולה וקורא ק"ש ומתפלל וחוזר זה וחופר ועולה חבירו וקורא ק"ש ומתפלל ודוקא כוך דלא חפיר ליה אלא חד אבל אם היה מקום ששנים יכולים להתעסק בו כאחד פטורים:
One who digs a sepulchral chamber for a corpse is exempt from reading the Shema, from [reciting] the Tefillah and from [wearing] phylacteries and from all religious duties enjoined in the Torah. If they were two [grave-diggers] and the time for reading the Shema arrived, one comes up and reads the Shema and recites the Tefillah and [then] he returns and digs and his companion comes up and reads the Shema and recites the Tefillah. [And this applies] only to a sepulchral chamber which only one person [usually] digs, but if it was a place where two people may attend to it together, they are [both] exempt.
מרחיקין הקברות מהעיר חמשים אמה:
Graves must be kept removed from a town [a distance of] fifty cubits.

Ashlei Ravrevei: Shulchan Aruch Yoreh Deah, Lemberg, 1888 (Public Domain) · Code of Hebrew Law by Chaim N. Denburg, Montreal, 1955 (CC-BY) · 2 se'ifim