Amplified 80dBA 40KHz Sound From 3V Square Wave?
Put a really big inductor (like 30 mH or so, get a bunch of 5 or 10 mH inductors and start putting them in series one at a time) in parallel with the piezo.  And cover your ears.  You may need to play around with the frequency and the inductance a bit to get the best oomph.  I got a surprisingly loud tone out of a piezo at about 4 kHz on about 4 volts with 30 mH of inductance.  I'm sure you can do even better with 12 volts.  

The idea is that the piezo's capacitance will resonate with the inductance, producing a much larger sound than you would be able to otherwise.  

Actually, for 40 kHz you might want a much smaller inductor,  maybe around 5 or 10 mH.