Mac Rumors has posted a good article about Apple's DRM model. Here's a slice from that article that addresses your question:
"If you're listening to a shared library or playlist, iTunes skips any purchased music in the list (if the computer is not authorized to play the music). To listen to a purchased song in a shared library or playlist, you need to double-click the song. If your computer is not authorized to play songs purchased by the person who is sharing the song, you'll need to enter that person's Apple Account ID and password to hear the song."
And there's an associated Tech Note that covers this too.