how to escape this trap?
Well, the answer depends a lot on the positions of the other pieces. Since the position you posted is impossible, the solution will prove elusive!
In a really general sense, though, your options are to put a heavy piece on the c-file somehow, pinning the c-pawn to the king...or to use a second piece (say, a knight) to attack the b3 pawn, so that when you capture it, you'll be trading a piece for two pawns, while simultaneously destroying the enemy king's shelter.

Now that you have seen the motif of Bxa2 b3 trapping the bishop, the next time you think to take that pawn you have to calculate what you will do in response to b3 and do not take the pawn if you can't calculate a good response to b3.
Here are two possibilities.
1) Bxa2 b3 Ba3#
2) Bxa2 b3 Bxb3 cxb3 and you maybe you can take the pawn on b3 or attack the exposed king. This isn't always true, so if you can't calculate it during the game, don't take the pawn on a2

Here is the position from Spassy-Fischer, World Championship match Game 1, 1972 after 29. b5.
And Fischer plays 29. ... Bxh2? Spassky traps the bishop with 30. g3, hunts it down with the king and goes on to win the game.
So at least you're in good company.

Just FYI: Fischer knew spassky was gonna trap his bishop! That would have been at least a draw... I doubt much it could have been a win, but maybe bobby tought spassky could blunder?
Thanks for the comments. I guess before I take the pawn, I need to be aware of the trap and have a solution to it. If I have no way to save the bishop after I take, then I shouldn't take the pawn in the first place.
Yeah, I probably should have mentioned it, but if a one move checkmate is available to you, that's probably a good way to go, too.

Thanks for the comments. I guess before I take the pawn, I need to be aware of the trap and have a solution to it. If I have no way to save the bishop after I take, then I shouldn't take the pawn in the first place.
Yeah, I didn't mean to totally confuse the issue. Of course, Fischer didn't overlook 30. g3 trapping the bishop. Reuben Fine has said that Fischer told him that what he missed was that after 30. g3 h5 31. Ke2 h4 32. Kf3 h3 33. Kg4 Bg1 34. Kxh3 Bxf2 white can play 35. Bd2 keeping the bishop trapped.
Fischer must have realized this by move 32 because he deviates from that line with 32. ... Ke7.