Start of by installing the plugin for dnf that allows you to lock versions.
$ sudo dnf install python3-dnf-plugin-versionlock
If you don’t know the full name of the package you can find it using dnf list installed.
$ dnf list installed | grep "hplip"
hplip.x86_64 3.18.3-1.fc27 @updates
hplip-common.x86_64 3.18.3-1.fc27 @updates
hplip-gui.x86_64 3.18.3-1.fc27 @updates
hplip-libs.x86_64 3.18.3-1.fc27 @updates
Lock packages by running dnf versionlock add followed by the package names separated by space.
$ sudo dnf versionlock add hplip.x86_64 hplip-common.x86_64 hplip-gui.x86_64 hplip-libs.x86_64
Adding versionlock on: hplip-gui-0:3.18.3-1.fc27.*
Adding versionlock on: hplip-0:3.18.3-1.fc27.*
Adding versionlock on: hplip-libs-0:3.18.3-1.fc27.*
Adding versionlock on: hplip-common-0:3.18.3-1.fc27.*