I am not sure what you intend to do with the third variable.
set.seed(345) # make the example reproducible
a <- rnorm(100,10,10)
b <- rnorm(100,5,5)
c <- rnorm(100,1,1)
d <- data.frame(a,b,c)
library(MASS)
DENS <- kde2d(d$a,d$b)
contour(DENS)

filled.contour(DENS,plot.axes = {
axis(1)
axis(2)
contour(DENS,add = TRUE)})
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.0.5

ggplot(d,aes(x=a,y=b))+geom_density2d()

Created on 2021-07-26 by the reprex package (v0.3.0)