I have written Hosentasche and it wasn't right. Why? It can't be wrong.
Well, it's not quite the same. "Hosentasche" means "trouser pocket" / "pants pocket".
Christian is somewhat right. When you speak of "pocket" as "Hosentasche" it is mostly clear because of the context it is used. And that is true for a lot of translations or usages of pocket in German. If you have no context given then the best translation for "pocket" would be just "Tasche".
Actually, we will accept "Hosentasche" for pocket. But @christian is also right on, strictly speaking. Thanks!