Reproducing code (v8.0.0a0):
from rdflib import Graph, URIRef, Literal
g = Graph()
g.add(
(
URIRef("https://example.com/subject"),
URIRef("https://example.com/p/predicate"),
Literal("object"),
)
)
print(g.serialize(format="turtle", base="https://example.com/"))
@base <[https://example.com/>](https://example.com/%3E) .
@prefix ns1: <[https://example.com/p/>](https://example.com/p/%3E) .
<subject> ns2:predicate "object" .
Please note "ns1" declared, but "ns2" used in the triple.