Set an appointed time. Sure, you and your boyfriend both have demanding jobs, but that's no reason not to set aside a half-hour or so in the mid-afternoon (when productivity is at its lowest, anyway) for a quick flirting session. It's true that flirting is often more effective when it's unexpected, but getting your guy all hot and bothered three minutes before his big PowerPoint presentation won't do either of you any good.
Keep it PG-rated. At the start of your IM session, ask your significant other if she other has people in her office, or can otherwise be seen (and harangued) by a passing supervisor. If you're both alone, feel free to be as racy as you'd like, but if there's a chance of being caught, don't use inappropriate language (and especially not in all capital letters followed by 17 exclamation points).
Write as fast as you can. There's nothing worse than making a suggestive remark via IM, then waiting three or four minutes as the person on the other end composes a thoughtful reply. The whole point of this medium is its immediacy-otherwise, you might as well be trading emails (or, horror of horrors, actually talking on the phone).
Don't divulge any corporate secrets. If you keep your banter properly flirtatious, it's unlikely that a geeky IT podperson who downloads your IM transcript off the corporate mainframe will have grounds to report you to the CEO. But if you IM your girlfriend about what a jerk your boss is (the most closely kept corporate secret of all), you may be exposing yourself to retribution further on down the road.
Know when to stop. When you're at the office, 20 or 30 minutes of IM banter is fine, but if you and your girlfriend start IM'ing from each other's apartments (or, worse, from different rooms in the same house) you may want to work on your personal communication skills. If you're in doubt, pick up the phone for a change, or actually meet face-to-face for dinner and some non-virtual sex.