According to this wiki article, Dehn solved Hilbert's third problem within a year. Did Dehn start to work on the third problem after Hilbert's talk? Since Dehn is Hilbert's student, they were likely to know what problems each other had been working on. Can it be the case that Dehn already work on the problem for a while before Hilbert honored it to be among the 23 prestigious open problems perhaps to encourage Dehn's efforts on the problem?
It depends on what counts as working "on it". His prior work under Hilbert was related to this area of geometry. Bolyai (1832) and Gerwein (1833) proved that polygons of equal area are equidecomposable, and Gauss urged a 3D extension in letters to Gerling mentioned by Hilbert. It was in the works in 1890-s. In 1896 Bricard reproved Gerling's 1844 result that mirror-image polyhedra are equidecomposable, and Hill showed that some specific tetrahedra are equidecomposable with a cube. Bricard claimed a negative result in general, but his proof was incomplete.
Nonetheless, it became the basis of Dehn's 1900 proof, see Krasilnikova, Hilbert’s Third Problem. Dehn was in Göttingen from 1899. Guggenheimer's Jordan Curve Theorem discusses an unpublished Dehn's manuscript from 1899, where he proved the Jordan curve theorem for polygons and then extended it to polyhedra, indicating that 3D geometry was already on his mind then. In his doctoral dissertation (1900) he showed that the Archimedean postulate was needed to prove that the sum of the angles of a triangle does not exceed 180°. His solution to the "third problem" meant showing that it is also needed to prove that tetrahedra of equal base and height have equal volumes (this is not the case for triangles).
The problem itself was not even stated among the 10 in Hilbert's August 8 Sorbonne lecture at the 1900 International Congress of Mathematicians. It only appeared in the printed version on the expanded list of 23, by which time Dehn already solved it, see Max Dehn, Kurt Gödel, and the Trans-Siberian Escape Route by Dawson:
"After graduating from the Gymnasium in Hamburg, Max went first to Freiburg and later to Göttingen, where he received his doctorate in 1900 under Hilbert’s supervision. In his dissertation he established that the Archimedean postulate is essential in order to prove in neutral geometry that the sum of the angles of a triangle does not exceed 180° (Legendre’s theorem).
Later that same year, soon after Hilbert’s address on “Problems of Mathematics” at the International Congress of Mathematicians in Paris (and before the appearance of its printed version, in which the list of problems was expanded from ten to twenty-three), Dehn established a related result that solved the third of the published problems (one of those left unstated during the lecture ): By exhibiting two tetrahedra with the same base and height that are neither equidecomposable into finite, congruent parts nor equicomplementable by such parts to produce two polyhedra that are equidecomposable, he demonstrated that the Archimedean postulate is also needed in order to prove that two tetrahedra of equal base and height have equal volumes. For his solution of Hilbert’s third problem Dehn was awarded his Habilitation at Münster, where he served as a Privatdozent from 1901 until 1911."