# Namespace prefix is not defined

Source: https://xmlvalid.com/errors/namespace-prefix-is-not-defined

> An element or attribute uses a prefix (inv:) without its xmlns:inv declaration.

Example message: `Namespace prefix inv on invoice is not defined`

## Why it happens

- A fragment cut out of a larger document, where the namespace was declared on an ancestor.
- A misspelt prefix.

## How to fix it

- Declare the prefix on the element or an ancestor: `xmlns:inv="urn:example:invoice"`, with the namespace URI the schema expects.

## Example that fails

```xml
<inv:invoice/>
```

## Fixed

```xml
<inv:invoice xmlns:inv="urn:example:invoice"/>
```
