Close your eyes—well, actually, this isn't going to work if you close your eyes. Instead, leave them open and try to picture the setting of this story. What does the library look like? What does Paris look like? What does D—'s room look like?
Can't do it. Poe just isn't interested here in external details. The story might as well take place in Peoria, Illinois as Paris, France (although Paris does lend a romantic, exotic feel to the story); and if you changed a few of the details, it could just as easily take place in 1945 or 2045. But that doesn't mean setting isn't important.
This story may not take place in a morgue or a creepy house, but it wouldn't be Edgar Allan Poe without a touch of the Gothic. Here, it's the simple, smoky darkness of the "little back library, or book-closet, au troisième, No. 33 Rue Donot, Faubourg St. Germain" (1). Faubourg St. Germain is a real part of Paris, though Rue Donot seems to be a fictional street, but we can't be sure.
Au troisième means that their apartment is on the third floor, which is probably actually the fourth floor, because in France the first floor is considered the ground floor and not counted. Got that? This is also a clue to the narrator and Dupin's social positions, since apartments way up at the top of the stairs were usually not as expensive as apartments lower down. (And if you've ever had to haul groceries to a five-story walk-up, you know why.)
While the dark, smoky room creates a Gothic mood, it also seems decidedly anti-Gothic. People talking, thinking, and smoking pipes in a library seems stable, calm, and not very scary or creepy. (Unless you count Dupin's frighteningly long explanation of how he solved the mystery). There's even something comforting about it. It's a setting perfect for the coldly logical explanation of how Dupin locates and purloins the letter.
Dupin and the narrator have already been sitting in the dark, thinking, for an hour before G— arrives. When he shows up, Dupin decides not to turn on the lights because G— needs him to think about something: "If it is any point requiring reflection […] we shall examine it to better purpose in the dark" (3).
This is a little bit weird, because it's common to associate light with knowledge—you know, "shed some light on the subject," "illuminate a subject," that sort of thing. But according to Dupin, all of life's truths are in plain sight. To see them we sometimes need to obscure everything except what we are examining.
When Dupin goes to D—'s house to look for the letter, it's actually daytime. Still, he closes his eyes, figuratively, to everything but the letter, even using green glasses to darken his vision (you know, like sunglasses). In contrast, G— visits D—'s apartment only at night. The darkness is supposed to provide cover for him to look for the letter. Figuratively, this darkness does in fact obscure the letter from G—, even though, ironically, he shines a light into every (almost every) nook and cranny.
So: Dupin uses darkness in light; G— uses light in darkness. It's an unexpected and totally cool reversion, and it does the same thing that Dupin does—forces us not to take anything for granted.
Ultimately, the story suggests that seeing clearly or not seeing clearly have little to do with darkness or light, and lots to do with individual vision, and individual ability to process what is seen. Through setting, "The Purloined Letter" plays with ideas of light and darkness to comment on different ways we approach reality and the search for truth.