Is there a setting in Audacity where I can only record the piano? I'm trying to record with a track which is also on my laptop. While I am playing the track or MP3, I also play the piano alongside, though my current setting records them both. Is there a setting where Audacity only records the piano output?
What gets recorded is not primarily controlled by Audacity, but by Windows' mixer settings.
The general principle is that Windows has a "Recording" channels (that's what Audacity gets) and you may or may not be able to send different sources to it. The default setting is usually the mix of all the sounds in the card. But perhaps, depending on sound card, and depending on how you connect the keyboard to the computer, you may be able to take only the keyboard as the source of the Recording channel in Windows.
Having said all that, there's also a much simpler solution: copy the MP3 to your smartphone, play it from there, and record the piano through the computer, without any interference.