Challah, Chapter 3, Mishnah 1. Just as we find in the laws of Terumah and maaser that a person may eat a casual snack - but not a fixed meal - from tevel, produce from which terumos and maasros have not yet been separated, so long as the point at which its work is completed has not yet arrived, so too the same rule applies to challah.
Eating Casually from the Dough:
The Mishnah establishes that one may eat casually from the dough up until the stage at which its preparation is completed. That stage varies according to the type of flour:
"Bachittim - gilgul" (in wheat - rolling): the stage at which the mixture binds together and becomes dough.
"Base'orim - timtum" (in barley - sealing): a somewhat different process, since barley flour does not readily bind into a dough. It requires more work, and the holes that form in it must be sealed up.
After the Gilgul and the Timtum:
Once these processes have taken place - the gilgul in wheat flour or the timtum in barley flour, each according to its own particular manner of mixing - it is no longer permitted to eat from the dough even casually, until challah has been separated from it. One who eats from such a dough before challah has been separated is liable to death at the hands of Heaven, exactly like one who eats tevel from which terumos and maasros have not been separated.
Separating Challah from the Moment the Water Is Added:
Nevertheless, the Mishnah teaches us that from the moment the water has been added, even before the entire batch has become dough, challah may already be separated from it. This is conditional, however, on there not remaining a surplus of unmixed flour amounting to five quarters of a kav of flour, which is the measure that obligates in challah.
For if there remains a full challah measure that has not yet come into contact with the water and has not begun the process of becoming dough, that flour is not exempted by this separation, and the separation does not take effect on it at all. Since it contains a full challah measure, challah will have to be separated from it on its own and separately. The separation that was made is effective only for the portion that has already come into contact with the water.