Maybe, yes. Many states say that you are not guilty of the crime of burglary if you: entered a structure or vehicle, and
did so with the consent of the owner of that structure or vehicle. But note that some jurisdictions say the defense only works if: a property owner consented to you entering a structure, and the owner knew of your intent to commit a crime.