If you play the music not too loud, it should not be picked up by your microphone very much (also depends on the pickup pattern of your microphone).
To check this, mute every audio source except the mic source in OBS and do some test recording only your mic by OBS while playing your music over speakers. Then check how it turns out in the video. There is no way to make your microphone stop picking up what's present in your room - it's the purpose of the mic to pick up audio. To make foreground (voice, desired) and background (music, undesired) as separate as possible, move your mic as close to your mouth as possible, so you can turn the mic volume as low as possible, so the background is so low it cannot be heard.
Also make sure the music is coming through only one audio source in OBS and there is no feedback loop. Chances are high for this, if you record desktop audio (speakers) in OBS and not your audio sources directly, or if you use the audio monitoring feature of OBS and use some audio device as monitoring device that OBS is also recording.