Berachos, Chapter 3, Mishnah 5. This Mishnah deals with the question of what a person who is a baal keri should do in the various situations in which he may find himself.
Remembering in the Middle of Davening That He Is a Baal Keri:
The Mishnah opens with a person standing in the middle of Shemoneh Esrei who remembers that he is a baal keri, and according to the decree of Ezra he is not permitted to daven Shemoneh Esrei. The Mishnah rules that he does not actually interrupt his prayer; rather, he shortens each of the berachos of Shemoneh Esrei and merely mentions them, in an abbreviated form.
Reciting Shema After Immersing:
The case is a baal keri - including even one who was together with his wife - who goes down early in the morning to immerse in a mikvah. He faces two possibilities:
If he is able to come up out of the mikvah, cover himself with a garment and recite the Shema before sunrise, that is what he should do: come up, cover himself and recite it.
And if he cannot, and he wishes to recite the Shema before sunrise, he covers himself with the water and recites the Shema while he is still in the water.
The Gemara notes, however, that in order that there be no problem of "libo ro'eh es ha'ervah" (his heart seeing his nakedness), the case must be understood as referring to murky, cloudy water in which his nakedness is not visible.
The reason we are discussing reciting Shema before sunrise is that this is the ideal way of performing the mitzvah, the finest way to fulfill it - as the Mishnah stated in the first chapter, that one should finish reciting Shema by sunrise, and this was the practice of the vasikin.
Foul Water and Flax Water:
The next part of the Mishnah, although it is brought in the context of one covering himself with water, is relevant in general to reciting Shema and to all matters of holiness, words of Torah and prayer. The Mishnah says that he may not cover himself with foul water - whether water that gives off a bad smell of any kind, and even urine, which will be discussed below - and likewise not with flax water, the water in which flax was soaked, which also has a bad smell. Not only may he not cover himself with such water, but he may not even recite Shema or say words of holiness in its vicinity.
"Ad sheyatil letochan mayim" - "Until He Puts Water Into Them":
The Gemara says that this is a hint specifically to urine: if one puts a revi'is of water into the urine - the measure of a revi'is corresponds to a single urination, and one must put a revi'is of water in for each one - the water dilutes it, and from then on a person may recite Shema and say words of holiness in its vicinity. Until he puts in the water, this is not possible.
"V'chamah yarchik meihem umin hatzo'ah?" - "And How Far Must He Distance Himself From Them and From Excrement?":
How far must a person distance himself from urine or from excrement, from waste? The Mishnah rules: "arba amos" - four cubits. And when does this apply? The Gemara says that this is only when the urine or the excrement is at his side or behind him. But if it is in front of him and he can see it, he must distance himself enough that he does not see it at all.
In summary: In this Mishnah we learned that one who remembers in the middle of Shemoneh Esrei that he is a baal keri does not interrupt but shortens the berachos; that one coming up from the mikvah should cover himself and recite Shema before sunrise, and if he cannot, he covers himself with murky water and recites it while in the water; that one may not cover himself with foul water or flax water, and may not say words of holiness in their vicinity until he puts water into them; and that the required distance from urine and from excrement is four cubits to the side and behind, and in front of him, enough that he does not see it.