Brachot 18 - When one's dead lies before him

One whose dead relative lies before him is exempt from the Shema prayer, from the Amidah (Standing) prayer, from donning tefillin, and from all other mitzvot stated in the Torah - although he cannot violate any prohibitions. That is so, because he is preoccupied with the mitzvah of burial, just as a bridegroom was preoccupied with the mitzvah of consummating the marriage . This refers to his seven immediate relatives: mother, father, daughter, son, sister, brother, and spouse.

"Before him" is understood broadly: even if he is in a different house, burial is his obligation, and he therefore does not say Shema. So too is "One whose dead relative" - even if it is not his relative, but it is his obligation to bury him, he is exempt from mitzvot in his presence.

Even in the cemetery where other dead are buried, he should not wear his tzitzit, tefillin, or walk around with the Torah, since the phrase "He who mocks the pauper (that is, the dead, by showing them that he can do mitzvot and they can't) - he scorns His Maker."

It once happened that Rabbi Chiya and Rabbi Yonathan were walking in a cemetery, and Rabbi Yonathan's tzitzit were dragging over the graves. Rabbi Chiya told him, "Lift them up, or else the dead will say, 'Tomorrow they are joining us here, and today they are mocking us!'" Rabbi Yonathan asked, "But do they know?" The Talmud goes into multiple proofs and disproof of whether the dead know what is going on in this world, with the tentative conclusion that they may know, because of their own high status, or because of the status of a live person who needs to communicate with them.

Art: Theodore Gericault - Head of a dead young man