The correct answer is D. from.
The preposition “from” is used to indicate the source or origin of something. In this case, the speaker is asking where the listener bought the dress. The listener could have bought the dress from a store, a website, or even from another person.
The other options are not correct because they do not indicate the source or origin of the dress. The preposition “of” is used to indicate possession or association. The preposition “on” is used to indicate location or position. The preposition “for” is used to indicate the purpose or intended recipient of something.