In DC they have stated they will not mess with interstate travellors because of the federal transporting law as long as they do not stop and get out of the car.
While the reasonable interpretation of the federal law as I see it is that when one travels through a state (like Texas maybe?) where it is impossible to go through without stopping for food, gas, sleep or bathroom breaks, they should be allowed to stop. DC does not see it that way and it would be hard to argue different that issue with a judge when it takes an hour at most to drive through DC in traffic (I guess one could argue they got lost and it took many hours to find the way out and that actually happened to a friend and I in DC when we were young).
If you were to stay in neighboring Virginia, I seriously doubt there is an issue with a gun in a hotel room. I am not familiar with VA law and there may be something about hotel room stays, but I doubt there is a problem because it is an open carry state.
If you were to stay in MD, well this is the biggest gray issue I have ever seem about MD law. While it would conceivably be reasonable to say one is not just travelling through the state, but one is visiting the state for some sporting event or hunting and has to stay somewhere local, it would be legal to stop at a hotel, at a gas station, for a bite to eat, etc.
However, since MD only allows the possession of handguns while in state (when the federal law does not apply as far as transporting) for specific circumstances, it says one may " (6) the wearing, carrying, or transporting of a handgun by a person on real estate that the person owns or leases or where the person resides or within the confines of a business establishment that the person owns or leases;".
Now is renting a hotel room leasing? Is it where one "resides"? It reads to me as a layman that it is allowed to have the handgun in the hotel room.
Now to make it even more confusing, if one were to leave where they are residing in MD to go to an informal or formal target shoot within the state, then they are allowed to transport under MD law and the federal law may no longer apply since it is intrastate. Since MD only allows the trasnport to or from a "bona fide residence" as one of the destinations in some of the exceptions, the question now is if "leasing" a hotel room makes it a "bona fide residence"?
All in all, unless you are extremely familiar with that state's law, leave it in the trunk because in some states it would take a test case to sort out the complexities and I don't think you would want to be that test case.
Edit: The MD transporting law applies to handguns. There is no state law I am aware of that retricts the tranport or possesion of unloaded long guns. Except for one county and one or two cities, I doubt there is a problem at all to transport an unloaded long gun in MD and I doubt there is anything retricting the possesion of rifles in a hotel room loaded or unloaded. Notice I said "doubt" because I am not a lawyer.