Mass is supposed to be celebrated in a properly consecrated church building if one is available and suitable, but we have 2000 years of practice in coming up with alternatives in times of persecution.
When the Roman pagans persecuted us, we met in the catacombs. When the English made Catholicism illegal in Ireland, the Irish would meet in the countryside around large rocks ("Mass stones") which were used as altars.
The Japanese Catholics kept the faith alive for 200 years -- entirely without priests and bishops, because all of their priests and bishops had been killed by the state.
If you have the chance, there's a book you'd enjoy called "With God in Russia," by Fr. Walter Ciszek, S.J. Fr. Ciszek was an American priest from Pennsylvania who spent almost 20 years in Soviet Russia; several of them in the Lubianka prison, and several more in a GULAG slave-labor camp.
In prison, he would celebrate Mass in his bunk or on a wooden crate, etc. When he got out, he ran house churches in a couple of different places and cared for a large flock of Catholics and Orthodox -- until the KGB shut him down and ran him off to a different city, to start over again.
I remember reading about Blessed John Paul II when he was a bishop or cardinal, back in Poland, celibrating mass in a planned brand new Polish city which was not going to have a church built. The residents stood up to the leadership and celibrated in an open field mass. In time, a church was built on the site of the open field.