The USt-IdNr. is issued by the Federal Central Tax Office (BZSt), not by your local tax office. You need it for reverse charge invoices to EU business clients.
You can request it with your tax registration questionnaire or later. Many freelancers put it on invoices instead of the Steuernummer to keep the tax number private.
Full guideVAT number in Germany: what it is and how to get oneRelated terms
General information on German tax law, not advice on your individual case.