"I do not know where I learned it."
Translation:Ich weiß nicht, wo ich es gelernt habe.
It is not so much about formal versus informal language, but about translating the pronoun as closely as possibly while preserving a natural sounding sentence. It is just as natural sounding to say "...where I learned it" or "...where I learned that". Note that "that" is demonstrative pronoun, it is rather pointing at an object that might be present.