It is not pleasant to say, but the chances of a mugging are not uncommon in Barcelona. In the unfortunate situation that your travel document is also stolen, there are a few things you will need to do, especially obtain a provisional travel document, if you don't have another ID.
There are many precautions that travelers can take to avoid running into such situations, however one of the simplest is to make a photocopy of your document, leave the original at the hotel, preferably in the safety deposit box, and go around town with the copy in your pocket.
Block credit cards
Calling the various companies and banks to have your ATM or credit card blocked is something to do immediately, but making calls from your mobile phone could be very expensive: go to a locutorio, one of the many internet cafes, where you can call Italy and at the same time have internet available in the same place.
Report the theft
A mandatory step for any subsequent step, you must go to the nearest police station. Within the police stations in the center, forms are almost always available to fill in in Italian, there will hardly be any communication problems, as this is a rather common event. In case you know what wallet they say portfolio, and the identity card is called DNI (pronounced deneì). There are police stations scattered throughout the city, the two easiest to reach are those in Plaça de Catalunya and Plaça de Espanya, but just ask the policemen around, however widely present in all the main places in the city, to be directed to the station nearest.
Return to Italy - the airport
In theory, a copy of the loss report would be sufficient to be able to return to Italy, certainly for the flag ones, Alitalia and Iberia. However, some low-cost airlines, such as Ryanair, ask their travelers to show a travel document, albeit provisional, obtainable only at the Italian consulate in Barcelona, however recommended to avoid problems at check-in at airports. Those who leave without the permit, try to arrive well in advance at the airport, in order to complete any formalities.
Request a provisional travel document from the Italian consulate
According to the official website of the Italian consulate in Barcelona, you must complete this form, and present yourself at the consulate with two passport photos and a payment of 1,55 euros to the general consulate account, on ES05 0049 4707 50 2616078401, at Banco Santander , of which there is an office right in front of the consulate.
The Consulate General is located in Carrer Mallorca, 270: it can be easily reached on foot from the Diagonal metro station (lines 5, 6, 7 and 11): go down the Passeig de Grácia, take the third street on the left, on the same side of Casa Milà, and proceed to 270 The consulate is open to the public on Mondays, Wednesdays, Thursdays and Fridays from 9:30 to 13:00, and on Tuesdays from 14:30 to 17:30.
You can call the consulate number during office hours at +34 (prefix if calling from an Italian phone) 902.05.01.41, or through the Call Center (also in Italian) at 807300747 (from Spanish phones). Outside these hours, the consulate officer on duty can be contacted on +34 659790266.
The consulate does not make copies of identity cards or passports, unless you are registered in the Italian registry for residents abroad (AIRE), so you can only obtain a temporary travel permit, which is only necessary for flights in Italy through Ryanair, and a few other companies. For all other official situations, such as renting a car, or registering in a hotel or B&B, just show the copy of the theft report.