In The Name Of This Book Is Secret, the narrator specifically says that he cannot reveal where the story is set (or even the real names of the characters) because it is too dangerous. The book is just as strange as it sounds.
In the Discworld continuum, one of the very early books (when they were “straight” parodies of mainline fantasy fiction) has an author’s foreword by Terry Pratchett reading, “This book contains no maps. If this disturbs or offends you, feel free to go and draw one of your own.” Fans did, for a while; one became canon about thirty books in, but this hasn’t stopped all manner of arguments about specific locations.
Don Quixoteinvokes this trope in the very first line: “In a village of La Mancha, the name of which I have no desire to recall…” Scholars have deduced that the village is Argamasilla de Alba, where author Miguel de Cervantes was imprisoned for a time (and where he began to write the novel) – no surprise he had no desire to recall the place. The last chapter suggests that In-Universe, not revealing Don Quixote’s hometown would allow all the villages of La Mancha to compete for the right to be his hometown in legend.
Animorphs is up-front with the characters saying that they “can’t let you know who we are, or where we live.” The last book does say that they live in California, somewhere around Santa Barbara, but there are earlier hints as to that location, such as the region’s geography and the conveniently nearby zoo/theme park “The Gardens”.
The Saga of Darren Shan, as well as the Demonata, never reveal the name of their town, city, or country. Darren's school in the first book is based on one near the author’s home in Limerick, Ireland. It feels very Irish in general, too. Lord Loss and a few of the sequels take place in Carcery Vale.
John Dies at the End is set in the town of “Undisclosed”, with the only information ever given about it being that it's somewhere in the American Midwest. Before the book was published, the town was Rockville, but fans took this to mean it was set in the real town of Rockford, Illinois, so it had to be changed. The Alternate Reality Game on the website suggests that it’s Cairo, IL, based on photos of the town and multiple references to the Egyptian city of the same name.
Most of Charles de Lint’s stories are set in the city of Newford, whose location has never been stated. It’s not even clear if it’s in Canada or the United States, although the author does live in Ontario.
Saramago's novels Blindness, Seeing, Death with Interruptions and All The Names are all set in undefined cities and even countries. It’s a safe bet they take place in Portugal, even though the unnamed country in Death with Interruptions is a monarchy.
Without Blood by Alessandro Baricco includes a note at the beginning stating that this trope was used intentionally so as to universalize the story. Spanish character names are used “due to their music” and do not indicate a Spanish setting.
Huge by James W. Fuerst would seem, according to careful examination of Huge's descriptions in the story, to be set in Eatontown, New Jersey. However, while some aspects of the book’s geography match up with Eatontown (the location of the mall and the Circle, the town's proximity to the Garden State Parkway), the author has obviously taken care to scramble other aspects and make the setting more generic. The proof is in the location of the reservoir relative to the mall; it just doesn't work in real life.
The main action in Charlie and the Chocolate Factory, in the original U.K. edition, seems to be set somewhere in Britain (probably London), but it's otherwise ambiguous. Cultural Translation has Charlie finding a dollar in the snow in the American edition, rather than the 50p of the UK edition. And then the sequel, which was published in the U.S. first, explicitly puts the action in the United States.
The first series of Warrior Cats was set in a forest based off of New Forest in southern England, but in the second series, the Clans moved to an entirely fictional new forest and have encountered some wildlife that can't be found in the UK, making it pretty hard to determine where the series is set. Even the authors aren't sure.
M. T. Anderson's Feed is set somewhere in America, but apart from that the only clues are that it is not too far from the ocean. The problem with pinning down location is that the book is set in the future, so the modern indications don't quite fit.
Encyclopedia Brown lives in Idaville, USA, with a fair amount of Geographic Flexibility. Some hints suggest that it’s in the Southeast, and an Onion story spoofing the books put it in Florida. One story mentions that the Skunk Ape is “Idaville's version of Bigfoot,” further suggesting Florida and the Southeast. In another, thieves hid stolen fishing rods among the mangrove trees. Nearly all mangroves in the USA grow in Florida.
After Sinclair Lewis released Main Street, some people were mad at him for using the real town of Sauk Center, Minnesota. For every subsequent book he wrote, he used the fictional state of Winnemac, with its biggest city Zenith and a smaller town named (in quite a coincidence) Springfield.
Wicked Lovely is often presumed to be in Pennsylvania, but it is never actually stated where Huntsdale is, although it’s clearly American. Melissa Marr stated that this was intentional in an interview, wanting it to be a kind of Everytown, America. Leslie hopping on a train to Pittsburgh in Ink Exchange does give it a bit of a radius.
All the King's Men is set in a state that is never named and about which little is said except that it’s in the Deep South. However, given that it is very loosely based on the career of Huey Long, a governor of Louisiana in the 1930s, to say nothing of other clues, it's not too much of a long shot to just say that it’s set there.
The "Conni" series of books, written by Julia Boehme, is set in a town called Neustadt (meaning “New Town”). There are 26 Neustadts in Germany itself, nine more in other European countries, and one in Ontario, Canada.
The Cat Who books take place in Moose County, which is described as being “four hundred miles north of everywhere.” It’s definitely in the United States and is probably somewhere in the vicinity of the Great Lakes. That's all that has ever been explained about where it is.
Keys to the Kingdom takes this to such ridiculous extremes that all we know about the protagonist, Arthur, is that he lives on Earth. The author put in the effort to make sure his country, town, and even school remain nameless.
In The Hunger Games, the exact locations of the Districts and the Capitol are never made clear. There are some geographical clues, as well as the industries each area is known for, but nothing specific. We know only that District 12 is in Appalachia and the Capitol is in the Rocky Mountains somewhere.
In the endless Nancy Drew and Hardy Boys stories, they've always had trouble pinning down their hometowns:
Nancy's hometown of River Heights was originally placed in Iowa, but in the following years, it drifted as far east as New Jersey. In the most recent series, it's implied to be in Illinois, within driving distance of Chicago.
The Hardy Boys’ home of Bayport was a little better. It was always implied to be a coastal town, but that didn't stop it from drifting up and down the East Coast. Similar to River Heights, though, in more recent years, they keep it in the New York/New Jersey area to keep it within driving distance of New York City.
The novel series of Sandokan has a strange example that borders in real life. Author Emilio Salgari tried to base every location on a real place, but sometimes the maps he used were inaccurate or based on conjecture. Sandokan’s base on the island of Mompracem is based on an island on an old map that can’t be found on modern maps; although Keraman is a good candidate for its location, it’s mentioned in the books as a completely separate island. At least one location was a lake that was only theorized to exist, only discovered not to be there after Salgari’s death, and then dug up by The British Empire years later.
New Mayhem and Midnight in the Den of Shadows series. New Mayhem is probably somewhere around Concord, Massachusetts, but Nathaniel drugged Turquoise and Ravyn specifically so that they (and we) wouldn't know where Midnight was.
In The Supernaturalist, it’s very unclear where Satellite City is. The story is set entirely within the city, and very little reference is made to the outside world. And since conventional nation-states no longer exist in the book's setting, the city is inhabited by people of every conceivable ethnicity and background, although the currency is apparently dinars.
Paul Stewart and Chris Riddell's Barnaby Grimes series is set in an unnamed city that seems to be a mix of various 19th Century European cities, mostly Victorian London. Apart from being on a coast, it’s impossible to say where it is, and the few mentions of other places in the world are all fictional locations.
H.P. Lovecraft's Cthulhu Mythos stories intentionally avert this to help build up the sense that his horrors are very real and out there somewhere. He gives precise latitude and longitude for R'lyeh in The Call of Cthulhu, mentions real Vermont towns and faithfully recreates the local environs in The Whisperer in Darkness, and he often goes over travel plans in minute detail to recreate the protagonist's sense of discovery in the reader. Lovecraft Country flirts with this trope but is usually set firmly in New England — Lovecraft basically created a new river valley in Massachusetts to house Arkham, Dunwich, and any other usefully horrid little towns. Lovecraft himself lived in Providence, Rhode Island, so many fans choose to accept the stories are set somewhere around there.
In Harry Potter, the exact location of Hogwarts is never stated, and the school is stated to be under a spell that makes it impossible to put on a map. Fans have figured out it's in Scotland — it's the only place in mainland Britain that would take all day to get to by train from London, and the newspapers reporting on Harry and Ron flying a car over the countryside mention Muggles in Scottish towns seeing the car — but beyond that, its exact location in Scotland is unknown.
In The Genesis of Jenny Everywhere, Levendale City (where this version of Jenny lives) deliberately falls under this trope, despite clearly being in England and possibly the author's home region. It’s a joke on the fact there are several places or geographical features with the name “Leven” the author is familiar with, including a not-very important river that's a tributary of the Tees, and it plays on the idea that like Jenny, it exists “everywhere”.
In The Mysterious Benedict Society books, the fictional Stonetown Harbor is indicated to be in the United States on the Atlantic Ocean. It's also somewhere reasonably north enough that snow is normally expected in the winter. Other than that, though, the details of the exact location are left vague.
Czech author Jaroslav Foglar’s YA adventure books are generally set in Czech “Springfields”, including the protagonists’ hometown of Druhá Strana and the mysterious town quarter of Stínadla. The latter is supposedly based on Prague’s old town, as Foglar was from Prague, but it turns out that many Czech cities have mysterious old towns with serpentine alleys, and Foglar insisted that its location be kept secret for it to keep its mystique.
The Bailey School Kids series is set in a place called Bailey City in an unclear location. A relatively early book describes the local Red River as flowing into the Atlantic Ocean and that the original settlement on the river’s banks was close enough to the Atlantic for the city founders to worry about pirates. But in a later book, a Wild West ghost town is only a bus ride away.
Most of Stephen King’s stories are set in fictional cities Maine or in actual places King lived (Florida and Colorado in particular). The Running Man, however, is set in the fictional town of Harding, which is somewhere in the Midwest.