I don't have a ton of time to spend on this, but maybe this will help.
Since you have a mixer at your disposal, getting in touch with how it works will help you get this all working. as mentioned by others, you need to get everything going to one place and then disseminating the signal out from there to where it needs to go.
Here's what I see you doing (do all of this with the volume on everything turns WAY DOWN as there are chances for feedback until you get everything setup right):
1. Connect your sound card to inputs 1 and 2 on the Mackie.
2. Connect your monitors to the Main Outs 1/2 on the top right of the Mackie
3. Connect your headphones to the Phones jack on the top right of the Mackie
4. Connect the audio output of your midi keyboard to input 3/4 on the Mackie
5. Connect the Aux 1 Out from the Mackie to the Input on your soundcard
To hear the mains, turn up the main outs on the Mackie (and make sure that inputs 1/2 have enough signal from your sound card)
To hear the headphones, turn up the headphones on the Mackie
To hear the keyboard, use the volume on Input 3/4 on the Mackie
To adjust the record volume of your mic, on the channel where the mic is plugged in, adjust the AUX 1 Send knob. Do not turn up the volume to the main volume while the monitors are turned up here or you will get feedback. Also, do not ever turn up the AUX 1 send on the channels where the sound card outputs are plugged into the Mackie.
See what this gets you. Please be careful about the feedback thing and be very methodical about all of this. Your mileage may vary as I don't know the specifics of the routing within the Mackie - so you might have to mess with things a bit to get them to work right.
The point here is that the Mackie then becomes the central control point for both your record and playback.
Hope this helps. Gotta go - maybe someone else can chime in on this idea.