I'm thinking about a short novel series (a trilogy or a tetralogy) which I read in my school's library around 2012. It is targeted to teenagers or young adults. I read it in French pocket format but I don't know whether it was a translation.
The main focus of the series is a supernatural prison. I recall mazes, chasms and a room guarded by a bird-like magical beast, though this may not be 100% accurate. The ambiance inside the prison is gloomy, and people fighting or dying is common. What every prisoner has in mind is fear and survival. There are no cells, rather open spaces, and few to no human guards, because the prison is already a fortress on its own: it really doesn't need them. For many escaping is an absurd notion.
One of the protagonists is a young boy inside the prison; another is a young girl on the outside, the daughter of the prison's head. I think it happens in modern times (say, at least 1850) but of the outside I recall very little. They communicate several times to try to solve two problems: locating the prison and getting the boy out of it. Apparently no one outside, except the main prison staff, even knows where it is.
Around the end of the story, they discover that the prison, which they thought was buried deep under the ground, is actually a tiny cube attached to a bracelet around the prison head's wrist (which makes the escape even more difficult). I remember the boy and a few other prisoners manage to get out at the very end of the story.
I guess the ambiance of the prison and the twist about the cube are the most memorable aspects of this story.
Escape from Furnace by Alexander Gordon Smith is a very close match. To be honest, I cannot rule it out, but I didn't find any mention of the cube, and I definitely didn't read anything following the escape (then again, only three of the five books seem to have been translated to French).