It depends on what your recording/audience shall hear instead.
If your spotify(?) is a clearly different channel in the audio mixer (different from whatever your audience should hear), then go to the advanced-audio-settings with right-clicking into the audio-mixer end set your channel to "monitor only". If your monitoring device is your earphones (for instance), nobody else should hear that music.