the phone might be locked to the company you baught it from ( can't be used with any other sim card but the original sim). if you're trying to use a different sim the phone will not accept it.
on the other hand if you're trying to use your original sim out side spain, it might be that your company has no roaming agreement with any of the service providers in the country you've travelled to, that's why it's not recognized on the network. in that case, try to get a prepaid sim on your new location, that might solve your problem for the time being.
Fear not those who argue but those who dodge