I don't think you need to be concerned about this issue, which is great because I don't know of a natural way to do this. It's odd to demand that everyone be aware of views you hold just so they know what views you hold.
I guess this is a frame challenge. I think that it's unlikely that Alex would think you share Bob's political views just because you were nearby while Bob was talking at your office. I also think that it's irrelevant what Alex thinks of your political views based on such an insubstantial observation.
Why doesn't informing people "in the moment" work?
There are a couple of reasons. First, if Bob is rambling on about a political topic, and you interrupt him to make your own position known (making sure everyone in the room is aware you don't share Bob's views), you are implicitly countering Bob's position and arguments (if any). By saying you have a different position that you think is correct, you are saying that you think Bob is wrong.
That's not a big deal, but the natural follow up to that would be to discuss the issue. If you, personally, don't really want to do that, then fine. But it's not a good interpersonal skill to assert that others are wrong, to their face, and then refuse to explain why that is true or why a better position exists.
Further, because the problem you are worried about seems so unlikely it will seem mysterious why it's so important to you that everyone knows you disagree with Bob (again, it's far from automatic that people would assume you agree). It's sort of like a (made up) situation where Bob comes in with a new haircut, and you make a point of telling everyone that you think Bob is not attractive. Since there's no reason people would make such a specific assumption to the contrary (Bob's new haircut doesn't say anything about you or your preferences), it's bizarre to make such a blatant statement, and the perceived effect would be an insult to Bob (since you're criticizing him to no particular purpose).
Political discussions are usually about the issues being discussed, not the people who are talking. When Bob is describing what he thinks is true about the world, your counter with something that's true about yourself and your views is off-topic. It will always seem like you are either engaging on the issues (in seeming bad faith, if you're unwilling to discuss) or are levelling a personal insult against Bob. It will never seem like you are just making your position known so much as seeming like you want to point out that you think Bob is wrong, without any elaboration or opportunity for Bob to defend his position (which he is presenting without any implications about your own beliefs). There is no non-rude way to do such a thing, and that's true no matter how you try to express the information (verbally or otherwise).
What can you do instead?
You can physically separate yourself from Bob. Even if there is some possibility that people will assume you share his views (which, again, I think is overblown here), that's far less likely if you're at a different table on the opposite end of the room.
A good option, which I have used in workplaces, is simply to ask that he not talk about politics and thereby elide the issue. There are a lot of ways to do that, and I can't predict how Bob will react without knowing him, but something like
Let's keep things professional and not discuss charged political topics in the office. We all have to work together, and going on about contentious topics doesn't make that easier.
This may or may not work. If following/discussing/ranting about politics is Bob's only hobby, and he's passionate about it, he may not be inclined to stay quiet. Unless there's an office policy against discussing politics (and which you care to see enforced), you probably can't make him stop.
If you simply must do this, you can quietly mention your disagreement to Alex.
As described above, I really feel that this is not necessary. But if 100% of your objective is to make sure that Alex knows you disagree, you can quietly tell him so. Lean over and, in a low voice, say something like
I don't agree with Bob here, but I really don't want to get into a whole discussion with him about it.
Make no mistake: this is a bit weird, and will seem even more so if you are seated at a table with Bob, or are near enough that he might overhear you saying it. But the weirdness comes from the situation, in which you want to make the fact of your views known just so that people know it.
You can't have it both ways: expressing your political views requires you to actually express them, and doing so in contradiction of someone else (who is physically present and will observe your reaction) will almost always read as part of an issues-based discussion. Expressing your views in contradiction to Bob's is inherently participating in the discussion, so you can't really do that and avoid discussing.
Satisfying all of the preferences expressed in the question flouts many norms of conversation and social engagement, in service of a goal that seems unnecessary.
As mentioned in comments, it's hard to observe a norm in any kind of decisive way. But I know a lot of people who are politically interested but not especially politically engaged. They (variously) watch news programs, read news blogs/Twitter accounts/newspapers/etc., and have well-defined opinions and positions on major political topics.
However, these particular people do not put much emphasis on learning or building arguments for their positions. This has described myself as well on some occasions, though the worst of it was in years past (I'll blame youth and being too immersed in news sources that were ultimately shallow ones, but that's tangential).
The result is that, when they feel it's appropriate to speak up, they can mostly only express their positions, and generally are not able to defend them very well or persuade others to believe what they believe. Their inability to discuss the issues in any substance all but guarantees that a conversation on those topics will go nowhere-- what other result could there be, when all they can express is the fact of their belief?
The specific techniques that I use when such a person brings up a political topic, or otherwise tries to engage in a political discussion, varies depending on the specific people involved (some people are very resistant to being redirected, for example, and some can't handle confrontation or having their ideas interrogated).
But in all cases actual discussion of the topic fails, because the only things they can really express on the subject are:
- that they have an opinion
- What that opinion is
So when they express their views, conversations either move on (essentially ignoring their comments), make a perfunctory acknowledgement that their opinion exists (and then move on), or become trapped in a cycle of trying to get more information than the person can express (if they don't know an argument that leads to their conclusion, they can't express it or respond to other arguments; all they can do is reiterate that they have an opinion and restate what that opinion is).
Because expressing only the fact of your view is a conversational dead-end, it's basically a non-sequitur. One of the general assumptions in a conversation is that someone making a comment is making a relevant comment (Grice's maxim of relation, if you've studied Pragmatics). These kinds of comments do not respond to previous points, nor do they invite additional input. They are conversation enders, since further discussion is impossible as there is no more information to discuss. Unless someone has asked for an opinion, simply stating an opinion and expressing that you hold it is, by itself, irrelevant.