You've got a couple things going on; I'll try to separate them.
First of all is your desire to be left alone. Second is your desire to not be rude or to offend people.
I'll start with the non-offensive part first. Part of the challenge here is: what do you normally portray yourself as? Are you always trying to be left alone? Do you only want to interact with people on your terms? That's going to determine how the people that know you interpret your actions. I'm going to assume that you do not always want to be left alone and that you understand that interacting with people only on your terms will lead to you being always left alone.
Something that I've seen people do is this: when a colleague approaches, greet them warmly. Converse with them for a minute or two. This will establish that you are friendly and willing to talk. "Hey there! How are you? Are you still working on [X] project?" Something like that is a good way to start the interaction.
Then, after an exchange or two, I see the person say something like, "As much as I enjoy chatting, I've set this time aside to work/meditate/think/run through something in my mind. If you don't mind, I'd like to get back to that in the time I have left. It's good seeing you; let's chat at [x time]." That establishes boundaries yet says you are interested in interacting - just not right now. In your case, a response of "I'm working through my break; I've got a deadline and need to focus right now." may also be appropriate.
I've also seen people start the interaction off with something like, "Hey there; I'm in the middle of meditating on something; is there something I can do for you?". That's a little more direct and I wouldn't recommend having that be the first thing to say unless it's with someone who's exceptionally unwilling to grasp a clue.
I don't recommend acting bored with a conversation. That's just a poor interpersonal skill and establishes your reputation as someone unpleasant (or worse).
Additionally... people as a whole don't like pauses in conversation and try to fill it with something. For the above method to work, you'll need to be able to accept pauses in conversation and not need to fill them.
Despite your efforts at politeness, some people have very thin skins and will be offended at the drop of a hat. They've gotten used to getting what they want from this behavior; the challenge here is to not let that behavior manipulate you. Don't argue, don't get defensive. If someone does get offended at your being polite yet establishing boundaries, that's their problem and not yours. Be polite yet firm and when the other party sees that their behavior is unproductive, they'll eventually stop it.