I'm not aware of any albergue directory (especially an up-to-date one) that is legally in the public domain for you to use in a commercial app. You need to do the hard work of contacting albergues and getting / confirming their details. I track over 800 albergues in TrailSmart. All of my information comes from the albergues directly, from first-hand research on the trails done by myself or members of my team, and from fellow pilgrims sending me info from their walk. All of the reputable app publishers that I am aware of do the same.
Note that many of the informal lists you'll find floating around the Internet are usually gathered from sources informally (such as from Eroski, Gronze, and other websites) but almost certainly don't have any legal right to the data. For non-commercial usage that probably isn't a big deal. If you use it in your commercial app, though, you could find yourself in hot water.
I recommend you look into the legal status of any sources you use if you aren't gathering it first-hand – you don't want your app pulled from the stores over IP claims. If in doubt, it would be worth the expense to discuss it with a lawyer.