This seems to be a bug in the OGR KML drivers - I've raised a bug.
UPDATE This is fixed in GDAL 2.2.2
In the meantime a temporary work around is to remove the kml:
from the output.
SimpleFeatureCollection featureCollection = DataUtilities.collection(list);
Encoder encoder = new Encoder(new KMLConfiguration());
encoder.setIndenting(true);
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
encoder.encode(featureCollection, KML.kml, os );
String out = os.toString().replaceAll("kml:", "");
System.out.println(out);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}