Well, I don't have any grand philosophy about when laws should be obeyed or not, but a more pragmatic approach.
If you have good access to the legislative and judicial systems put in place by a reasonably fair and democratic state, you should continue to use them. If you don't have these and are suffering an intolerable denial of human rights, by all means break the laws if you think it will help your cause.
The whole heroism of Rosa Parks action was that it sparked a demonstration that finally led to a number of similar cases to actually be considered in court, and leading to subsequent reform.
If you think the UN principle of self determination can be used to obtain Catalonian secession outside of EU Court rulings - success is very unlikely even if the opposing parties were to escalate to the use of violence.