You have to play the changes. The idea that you can find a scale in what ever key, and just play all over that scale, IME, doesn't really work. Like many guys have said, lead players can kind of get away with this - but even they have to play the right parts of the scale over the chord changes. If they play a "wrong" note, it's easy for them to kind of bend it, or slide up to a "right" note. If you hit a "wrong" note, it just sound like a big ole wrong note.
An example from a blues jam that I saw the other day - Song is Keep Your Hands To Yourself. Key of A. Pretty simple. This guitar player, is just playing his A pentatonic blues scale all over the song. It's a blues song, with a blues I-IV-V progression - makes sense and should work, right? Well, kind of. He's playing a minor scale, and the song is kind of more a major sounding thing. So it works over some of the chords, but it just doesn't sound right over other chords.
If you go to a jam,, IMO, guys should pick songs that everyone knows, OR that are easy enough you can play it without knowing it. That's why blues jams, and songs that have have I-IV-V progressions are so popular. But that doesn't always happen. I was at a blues jam a while back, and this guy gets up to do a song, I ask what key (it's in G), and I ask if there are any funny chords (meaning anything that's not a I, IV, or V). He says, "oh, it starts on the two, you'll follow." Well, the guitar player then leans over and says, there's a "church turnaround" (meaning a VI-II-V-I progression). Here we go...
My best advice, is keep going to jams, keep it simple, listen, and focus on playing the changes (providing a tonal foundation for the band). In what ever Key you are in, you should know what the I-IV-V chords are (most common),, and then probably also know where the II and VI chords are (next most common). If you hit the root note of any one of those chords, you will be just fine.
If you train your ear, by listening and practicing, going to jams, etc... you will start to hear when guys are playing major or minor chords (happens a lot with the II and VI chords). Then you can play your major and minor pentatonic scales over those chords and now you are doing fills, and melody lines, walking, etc... Over time, you will also start to hear common patters (like the "church turnaround") recognize them, and you will be ready to play them when you hear them. It takes time and practice.
IME, there is usually (hopefully) someone at a jam who can tell you or flash you a number. Watch and follow that guy. BUT, if you are playing a note that doesn't sound right, and that guy flashes you two fingers, it's up to you to know what the II chord is in what ever key you are in.
Just keep at it.