OK, this has gone in a slightly different direction, but same parts....
I have a 3.3v Arduino pin that is either the piezo, or used as some other input/output. It is never both, this is something that is configured at boot.
If it IS set as a piezo, then the MCP23017 switches in the ground to enable it.
If it is NOT set as a piezo, the MCP23017 stays low and the piezo is only connected to the Arduino pin in question.
Is this going to affect the usage of the Arduino pin for other uses? As in... will anything weird occur through that NPN (and therefore through the attached piezo) to affect the usage of the pin for other purposes if it's not a piezo pin?
Basically.... will that NPN make a clean enough break from 0v?
Can you drive the MCP23017 fast enough to produce a square wave that is fast enough for the piezo? They're I2C driven so rather slow, lots of data to be pumped over the slow I2C bus just to change one output. If not this idea is pretty much dead in the water.
You will need a resistor across the piezo to discharge it during the "off" part of the cycle.
An active buzzer would be the easier way to go about this. All you need to do is apply voltage and they make a lot of noise. Those things are dirt cheap, too.