Depends what kind of solution you're after. The point of a load balancer is to distribute work across systems that are equally capable of handling work. And the point of a messaging system is to encapsulate work into neatly divisible chunks. So the problem with your setup is that A is dependent on the message sent to B, which it shouldn't be.

One solution is to modify the overall system so that while waiting for a message, a system is in state X, then after processing a message the system returns to exactly the same state, X. All systems waiting for a message should be in state X. Messages should contain a precise definition of the work that any system can handle regardless of which message goes to which system.

The other solution is to kludge it so that the load balancer is capable of handling system specific messages, in such a way as to be able to send a message to the load balancer from the messaging source (or auto-generated by the load balancer) that says "To System A: Message M is being handled by System B", where M is the message you're asking about. To be honest this is really a nasty way of "fixing" the problem and at best should only be considered a horrible kludge until the real problem is solved, which is that your system design is broken.

Alternatively, if the reason for asking is that A is connected to some specific hardware that B doesn't have, so only A is capable of handling message M, then the messages, message originator and "load balancer" (quoted because it's ceasing to be a true load balancer at this point) need modifying so that they are capable of handling system-specific messages.