Although the recitation of Birkat Hamazon is generally required only after one eats bread, there is one situation where one would be obligated to recite Birkat Hamazon without eating bread: if one eats a large quantity of Mezonot food, such as cookies or cake.
The Rishonim (Medieval Halachic scholars) debate the question of which precise quantity of Mezonot food requires the recitation of Birkat Hamazon. Rashi (Rabbi Shlomo Yishaki of Troyes, France, 1040-1105) maintained that one recites Birkat Hamazon if he partook of 8 oz. of Mezonot food, whereas according to the Rambam (Rabbi Moshe Maimonides, Spain-Egypt, 1135-1204), one must recite Birkat Hamazon if he ate 6 oz. of Mezonot food. The later authorities write that one should endeavor to avoid this debate, and ensure to always eat either less than 6 oz. or more than 8 oz. of Mezonot food. One should try not to eat a quantity of 6-8 oz. of Mezonot food in one sitting, as he would then put himself in a situation of uncertainty regarding the obligation of Birkat Hamazon.
Practically speaking, then, a person who ate most of a cake, or who ate half a box of cookies, will very likely be required to recite Birkat Hamazon.
It should be noted that the obligation of Birkat Hamazon after eating this quantity of Mezonot food resembles the obligation that applies after eating bread with respect to a situation of Safek (uncertainty). If a person ate bread, felt satiated, and cannot remember whether or not he recited Birkat Hamazon, he is required to recite Birkat Hamazon. Since he ate to satiation, he is obligated in Birkat Hamazon on the level of Torah obligation, and he must therefore act stringently in situations of Safek. If, however, he did not eat to satiation, then his obligation applies only on the level of Rabbinic enactment, and he therefore acts leniently in a situation of doubt. This would also apply in the case of somebody who ate 8 oz. of Mezonot food. If he feels satiated, and he cannot remember whether or not he had already recited Birkat Hamazon, he must recite it. If, however, he does not feel satiated after eating this quantity of Mezonot food, then although he must recite Birkat Hamazon, he does not recite it in a situation of doubt, when he does not remember whether or not he had recited it.
Summary: One who ate 8 oz. or more of a Mezonot food – such as cake or cookies – must recite Birkat Hamazon even if he did not eat any bread. Some views maintain that this applies even if one ate only 6 oz. of Mezonot, and therefore when eating Mezonot food one should ensure to eat either less than 6 oz. or more than 8 oz., in order not to put himself in a situation of Halachic uncertainty.