This is actually a commonly occurring plot motif. However, the most explicit example of this would be "The Ones Who Walk Away from Omelas" by Ursula K. Le Guin (original publication). The titular "ones" are those people who refuse to accept the suffering for one child as a necessity to preserve their utopia.
The only chronological element of the work is that it begins by describing the first day of summer in Omelas, a shimmering city of unbelievable happiness and delight. In Omelas, the summer solstice is celebrated with a glorious festival and a race featuring young people on horseback. The vibrant festival atmosphere, however, seems to be an everyday characteristic of the blissful community, whose citizens, though limited in their advanced technology to communal (rather than private) resources, are still intelligent, sophisticated, and cultured. Omelas has no kings, soldiers, priests, or slaves. The specific socio-politico-economic setup of the community is not mentioned, but the narrator merely explains that the reader cannot be sure of every particular.
The uncertain narrator reflects that "Omelas sounds in my words like a city in a fairy tale, long ago and far away, once upon a time. Perhaps it would be best if you imagined it as your own fancy bids, assuming it will rise to the occasion, for certainly I cannot suit you all." Everything about Omelas is so abundantly pleasing that the narrator decides the reader is not yet truly convinced of its existence and so elaborates upon the final element of the city: its one atrocity. The city's constant state of serenity and splendor requires that a single unfortunate child be kept in perpetual filth, darkness, and misery.
Once citizens are old enough to know the truth, most, though initially shocked and disgusted, ultimately acquiesce to this one injustice that secures the happiness of the rest of the city. However, a few citizens, young and old, silently walk away from the city, and no one knows where they go. The story ends with "The place they go towards is a place even less imaginable to most of us than the city of happiness. I cannot describe it at all. It is possible it does not exist. But they seem to know where they are going, the ones who walk away from Omelas."
Le Guin provided a short essay expounding on the personal and philosophical origins of the story (which she traced to the works of William James and Fyodor Dostoevsky) when the story was republished in her short story collection, The Wind’s Twelve Quarters.