On a trip to Spain 2 years ago, I ran into this problem trying to buy tickets for a different attraction. I found that I was able to click a drop down menu which gave me 2FA choices for my different phone numbers as well as my email. However, this has to be set up with your bank/credit card. I was able to do the 2FA by email. But I'm not sure if you can do this for the Sagrada Familia site.
For my trip to Portugal last year, I contacted my bank before going on my trip and asked them to disable the 2FA all together so that I could avoid the problem. I turned it back on after I returned from my trip.
If you are in the middle of your trip, you could try phoning your bank/credit card and seeing if they will turn off the 2FA for you. Good luck.