The reigning holder of the FIFA Ballon d'Or will not play in the match to mark Hamburg's 125th anniversary after picking up a calf injury during training.
"During training yesterday (Monday), the player has suffered a bruised right calf. This morning (Tuesday), he had an ultrasound scan that revealed the presence of an intramuscular haematoma," the Catalan club said in a statement.
The match at the Hamburg Arena is the first of six pre-season friendlies for Barca as Tito Vilanova begins work as the club's new head coach. Next up for them will be a trip to Tangier to face Moroccan side Raja Club before warm-up matches against Espanyol, Paris Saint-Germain, Manchester United and Dinamo Bucharest ahead of the new season kicking off in Spain on August 19.
According to reports in Germany, there was a clause in the contract inserted when the Hamburg fixture was booked which means the German club now only have to pay Barca €800,000 for their appearance rather than the 1.2m due had Messi played.
With the 57,000-capacity Hamburg Arena sold out for the match, the club is now set to make a €900,000 profit on the fixture.
The club has offered to reimburse any fans who want a refund on their match tickets.