Welcome to StackOverflow! Now, matrices are 'by design / by construction' always two-dimensional. Internally, they are represented as a single vector with a dimension attribution of length two -- enforcing just rows and columns. So a 'three-dimensional matrix' cannot exist, and that means you cannot use NumericalMatrix.
But Array objects are supported in whichever dimension you want to use, including three. There are examples in the package i.e. this is adapted from one of the tests
Rcpp::cppFunction("IntegerVector x(){return IntegerVector(Dimension(2,3,4));}")
But what you probably really want is to look at RcppArmadillo and its cube class which has (way) more support for three-dimensional arrays right out of the box.