I don't use Audacity so I don't know how to do it in Audacity, but in Reaper you can use input monitoring to hear your guitar while playing over the other track.
I have a tutorial that explains how to set that up here:
Reaper Tutorial
Hope that helps.
-tkr