Maybe there are ways to ask so you will know.
You could ask "Is this a good time to talk?" "Are you busy?"
There are times someone will pop up on IM and just say "Hi". Nothing else. Waits for me to do the talking. Doesn't ask if I am already talking to someone (I
am online, probably not just sitting waiting for someone else to wander by.. lol)
I respond directly as well. "Hi, I'm talking to someone else/busy/just heading off, but I hope we can chat soon!"
When I start getting nothing but 'lol' and 'haha' and 'yeah' in reply, I figure it's time to go. It isn't too interesting at that point.