The result meant Barcelona finished third in Group E and will drop into the Europa League in the new year.
Barcelona needed to match or better Benfica's result at home against Dynamo Kyiv to progress to the last 16, but the Portuguese side comfortably won their game 2-0.
Playing behind closed doors, Thomas Müller opened the scoring on 34 minutes. Ten minutes later, Leroy Sane scored Bayern's second goal. Jamal Musiala added a third from close range in the second half.
Barcelona have not played in the Europa League since 2004, when Celtic knocked them out in the round of 16.