If your integrated amp has a "tape monitor" switch, hook the headphone amp to the tape output, if it's free. The headphone amp will always get sent whatever source you've selected, but the monitor button will let you mute the speakers so you can listen on headphones only.
If you don't have a monitor switch, you can hook the headphone amp to whichever of the outputs isn't volume controlled and then turn the volume knob on the integrated amp all the way down when listening to headphones.
If you have to hook the headphone amp up to a volume-controlled output for some reason and you wanted to use that for the sub, you can find various kinds of subs that don't require a volume-controlled output on your amp. Some have you wire the speakers through the sub and the sub has a crossover in it that sends the mids and highs to the speaker and handles the bass itself. This kind has a volume control of its own which you use to match the sub's volume to the speakers.
Another way would be to get a DAC for your CD player. Then you can decide which DAC you like best (the internal one or the out-board) and send that one to the integrated amp or the headphone amp, depending on which you listen to more. Send the other to the other amp. When you want to listen to headphones, you can turn the integrated amp off, turn the volume all the way down, or switch it to a source that isn't playing any sound at the moment.