It isn't straightforwards as Cegaton notes.
You could abuse Blender's ridiculous OCIO integration to achieve this however. Save the file as an EXR, and add the following stanza to the OpenColorIO configuration in datafiles/colormanagement
:
- !<ColorSpace>
name: One-Way XYZ
family: Input Special
equalitygroup: ""
bitdepth: 32f
description: |
One way transform to save an XYZ EXR.
isdata: false
allocation: uniform
allocationvars: [0, 1]
to_reference: !<MatrixTransform> {matrix: 1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1]}
from_reference: !<MatrixTransform> {matrix: 0.4124564, 0.3575761, 0.1804375, 0, 0.2126729, 0.7151522, 0.0721750, 0, 0.0193339, 0.1191920, 0.9503041, 0, 0, 0, 0, 1]}
Note that this is a one way transform! Don't use it for anything else. It also assumes the file was saved as default scene referred linear in an EXR.