- Peninei Halakha
Even though the fast starts at alot ha-shaĥar, one’s prohibition to eat sometimes begins the night before. Namely, if one had in mind not to eat anymore before the fast, it is considered as if he accepted the fast upon himself, and he may not eat anymore. Therefore, if one went to sleep the night before a fast and woke up before dawn, he may not eat, since he had already taken his mind off of eating. However, if he stipulates mentally before going to sleep that he will eat if he wakes up before dawn, he may eat, because he has not yet accepted the fast upon himself.
This applies to eating. With regard to drinking, however, the poskim disagree. According to Rema, one may drink before dawn even if he did not explicitly stipulate before going to sleep that he would do so, because many people drink of water when they wake up. Therefore, it is as if he had in mind to drink if he wakes up before dawn. Shulĥan Arukh (564:1), however, maintains that there is no difference between eating and drinking, and only one who stipulates before going to sleep that he will drink some water when he wakes up before dawn may do so. In practice, one who wants to drink before the fast begins should stipulate mentally that he will do so, but be-di’avad, one who wakes up before dawn and is thirsty may drink, even if he failed to stipulate this (see mb 564:6, Kaf Ha-ĥayim 564:10).
 This question is discussed in Ta’anit 12a. The reason for the prohibition is that one who goes to sleep takes his mind off of eating, and since these fasts were originally intended to begin at night, as we explained in section 1, if one takes his mind off of eating, it is as if he has accepted the fast. (See Ran 4:1, s.v. “Yerushalmi,” who mentions this rationale with regard to reciting Aneinu at night, even when one fasts only during the day.) Making a stipulation helps, as y. Ta’anit 1:4 indicates.
With regard to drinking water, since the dispute concerns a rabbinic law, the halakha follows the lenient opinion. Moreover, it seems that Rif agrees with Rosh who rules leniently. Taz 564:2 also concurs. Nonetheless, it is best to stipulate, as ma 564:2 and mb 564:6 state. Kaf Ha-ĥayim 564:10 cites several Aĥaronim who say that one who has a craving to drink may do so.
Tangentially, I would like to point out that even on a regular day, when one may not eat before Shaĥarit, one may eat before dawn and even begin a meal a half-hour before then. According to the custom of the kabbalists, however, one should not eat anything before praying in the morning, assuming one got regular sleep (Kaf Ha-ĥayim 564:7). However, even the kabbalists are lenient when it comes to drinking.