From Bulbapedia, the community-driven Pokémon encyclopedia.
The void is a nickname for the black area that surrounds indoor areas in the Pokémon games. It is not to be confused with the Mystery Zone.
In the programming for the games, all areas are surrounded by a tiled image, or in the case of Generation IV, an empty area. For most routes and cities, this tiled area is trees or water, or even rocky cliffs; however, as indoor areas tend to take up a small part of the screen, they must be filled with a blank tile to complete the illusion of being just a small part of a continuous world.
In the first three generations, the void is completely inaccessible, and attempting to walk into it using the walk-through-walls code only results in the game crashing. In Generation IV, the void is minimally programmed, as the player's location in Sinnoh's overworld corresponds to the location they would enter in the Underground, and can be accessed through certain glitches. Though the area between route and city areas remains covered in impassable trees, the void around an indoors area is, for the most part, clear to walking or running. Despite this, it can lock a player in, and the player can save here, leading to a potential need to restart the game from the beginning. However, use of the void in Diamond and Pearl Versions can lead to a player being able to access Seabreak Path and Newmoon Island, and therefore the ability to capture Darkrai and Shaymin without the need for an official event.