This assertion makes no sense. Barcelona is covered by an excelent public transportation network, including national, regional, and commuter railway services right in the city center, and there are entire blocks that are still unocuppied or including vacant old warehouses.
Barcelona's main problem is its populist government that uses anti-tourism political stunts to cater to radical socialist and anarchist pressure groups while screwing with the local's lives.
This sad political state of affairs only serves the interests of incumbent hotel operators and real estate speculators by ensuring that their past investments remain exceptionally proffitable and no competitor can enter the market to pick up the slack. Radical anti-tourism anarchist groups play the role of useful idiots to help preserve this state of affairs, but the real source of the problem is quite obvious, and so is the solution: allow the construction of new high-capacity hotels and provide incentives to maximize hotel occupancy, such as taxing vacant hotel rooms, so that repurposing apartments as pseudo-hotel rooms ceases to be an attractive investment.
Until this problem is actually understood, instead of blindly swallowing political propaganda, it won't simply go away,no matter how much noise and publicity stunts anarchist groups make regarding this issue.