Yes. If you have a valid passport and either a valid residence permit for a Schengen country or a valid Schengen visa, you will not be needing a visa for visiting Denmark.

You cannot apply for a Schengen visa in any country; instead, you must apply in the mission or embassy of the country where you plan to spend the most time. If determining this is difficult, particularly if you are taking a cruise or a bus tour, you can apply for a visa for the country where you will be arriving first. This is assuming you spend the same amount of time per day.