Hi and welcome to Just Answer!
Your state income tax liability is based on both - your residency and your workplace location.The location of your employer and where they have offices are irrelevant.If you are a resident of Puerto Rico - you are responsible for Puerto Rico income tax based on your residency. If you are working as independent contractor - your workplace is where you physically provide services.If you are working for the US company as an employee - the company should determine in which state your workplace is located and should register in this state. For instance - if your workplace is in Puerto Rico - your employer should register with Departamento del Trabajo y Recursos Humanos (DTRH) and pay unemployment taxes.However if your employer provides the workplace in a different location - for instance in California - your wages are subject of California income taxes. If your employer allows you to work remotely for your convenience - that doesn't change the location of your workplace for income tax purposes - and your personal income tax liability is based on the location of your workplace. Thus - if you are not sure - you need to contact your employer and verify.When you receive a paycheck stub - it should indicate if your wages are subject of income tax for any specific state - and such taxes should be withheld.In case your wages are subject of income taxes in several states - you will be able to claim a credit in your resident state - thus effectively will avoid double taxation of the same income.