You must do one year of preliminary med (or equivalent, such as a prelim year in fam med, peds, EM, surgery, or a transitional year).
Some dermatology residency programs offer an integrated 'preliminary' program year with their advanced dermatology program (also known as 'categorical programs'). Thus, you stay at the same institution for all 4 years. That first prelim year at the institution is reserved for the program's 'future' dermatology residents, who subsequently move on to year two (first year of dermatology training, technically) after completing the program's dermatology prelim year.
This is rare. Most programs work as you suggest, where the resident does a separate preliminary training year before going to another institution where they will train for three years of dermatology.
Sometimes, you can be accepted for your prelim year at the same place where you are accepted for your dermatology training, even though the prelim year is not integrated into the dermatology program. These prelim years are not reserved for the dermatology residents like they are in the integrated categorical programs.
If I may predict your next line of questioning, you apply for both the advanced dermatology 3 years and your preliminary year at the same time (you may also apply to categorical programs at this time as well).
If you complete a preliminary year or equivalent (or are currently completing that year), but have not been accepted to a dermatology program, you have two options:
1. Apply outside the match to a program where a spot has opened up. If you have finished your prelim or equivalent year, you may start in the program directly. This is dependent on programs opening up new positions or people dropping out of their positions.
2. Apply to dermatology programs in the match, and if you are accepted, do something for a the year that you would normally be doing your prelim or equivalent program.