Isolating digital I/O on an Atmega328
I would use a dual supply level translator such as 74LVC8T245. 

As stated in the datasheet, when either VCCA or VCCB are at the GND level, both ports are at high impedance (i.e. disconnected). Therefore you can connect, say, VCCA to your ATMEGA328's VDD, so when it's powered down, no problem will occur. 

You can also tristate the outputs by pulling OE high. In this way you can have your circuit automatically pulling OE high when you are connecting an external driver, to avoid contentions.

All inputs can accept 5.5V regardless the VCC voltage, and, as a bonus fact, you can also use a VCCA value different from the VCCB.