Drive logic signals when power might be off
Use dual-supply translating buffers like the 74LVC8T245. They are designed for partial power down, so supply voltages A and B can be switched arbitrarily. For bidirectional SPI, you will need two of them (one for SCK, SS, and MOSI and another for MISO).