Technically yes, but practically, usually no.
The magnetic field varies in three dimensions and the variations are not parallel to the Earth's surface. However, horizontal distances varies usually on a larger magnitude than elevation and for everyday use, the declination is only based on horizontal position.
The common model for the Earth's magnetic field, IGRF-12 (International Geomagnetic Reference Field) uses the radial distance from the center of the Earth (r) in relation to the geomagnetic conventional Earth’s mean reference spherical radius (a). In other words, the elevation. (a/r) will usually be almost 1, and the difference is less than any other uncertainties in the measurements, e.g. deviation due to magnetic anomalies.
The magnetic field is often calculated by using the published model and this code. As you can see (the code is rather easy to read), the vertical component is used to estimate the magnetic field for every location.
Online calculators are often used to correct declination for navigational purposes:
NOAA's calculator doesn't include elevation and is calculated at sea level.
BGS's and GA's calculators does, but the elevation have a small impact on the declination. Try it to see!
Simpler models, e.g the dipol model also suggest how the magnetic declination varies with distance from the Earth's magnetic center. The approximation work rather well at low latitudes and at the Earth's surface. It can also be used to model Earth's magnetic field in an astronomical context.
Apart from declination, there is also an inclination to take into account. Near the magnetic poles, the compass needle will not be horizontal, but get a dip. This can make normal field compasses almost useless near the magnetic poles (trust me, I tried..).