kableExtra::landscape() LaTeX Error: Environment landscape undefined

Have you explicitly added pdflscape to your preamble as suggested? You can (I think) do it like this:

header-includes:
   - \usepackage{pdflscape}

or alternatively:

        includes:
            in_header: filename.tex

where filename.tex is a file with some usepackage statements.