If Moshe Rabbeinu was taught the entire Torah on Mt. Sinai (Rashi on Vayikra 25:1, Rambam), how do we explain events such as the incident involving the Bnos Tzelafchad (Bamidbar 27:1-11), or the tamei people who wanted to bring the Korban Pesach (Bamidbar 9:1-14), where Moshe evidently did not know the end of the story as recorded in the Torah?
The gemara in Sanhedrin 8a deals with bnos Tzelophchad. The first opinion holds that Moshe forgot the halacha as a punishment for when he appointed judges and said 'any law too hard for you, bring to me.' as if he were the final word and not Hashem. This is learned from the words Vayakreiv/Vatikr'vun.
The second opinion asks on this: Moshe didn't say (by the judges) I'll teach you, he says I'll listen to it (the difficult case, maybe he won't know it either and have to ask Hashem). This question in itself indicates that, at least according to this opinion, Moshe was not taught every nuance of halacha.
His answer also implies this: Moshe was worthy of writing the parasha (unlike opinion #1), but Bnos Tzelophchad merited to have it written through them (megalg'lin z'chus al y'dei zakay), so vayakrev es mishpatan.
It could be the 1st opinion also holds Moshe wasn't taught every nuance, but he darshans vayakrev/vatikr'vun. (efshar)
So according to R. Yishmael, we have an easy answer regarding the people who were impure and wanted to give the Korban Pesach. We can say that Moshe hadn't been taught that aspect of the law yet.
It would be a little more difficult to answer this about the Daughters of Tzelafchad though, since the story happened in the last year of the Jews being in the desert, and it would stand to reason that by then Moshe had been taught the whole Torah.
However, the Gemara (Baba Basra 119B) says that while Moshe had learned the laws, there was an extra aspect which Moshe was unsure of, and that was whether or not the daughters of Tzelafchad should get the extra portion that would have been due their father, since their father was a firstborn. (See here for an in depth explanation of this).
This explanation would seem to indicate that Moshe had not been taught every detail of the law, like R. Yishmael said.
Some other answers for why Moshe had to go to G-d to find out what to do with the daughters of Tzelafchad (This page was a good source):