Unknown table 'table' in field list on referencing temporary table inside a trigger
The solution is now found by Akina, I made a mistake on IF NEW.barang_kode not in (kode_barang_tbl.kode_barang) THEN which should be IF NEW.barang_kode not in (SELECT kode_barang FROM kode_barang_tbl) THEN. I also made changes to my script which makes the same error on cast(dummy1.rvid as char). So here's my full script in the end. Thanks to Akina.
DELIMITER //
DROP TRIGGER IF EXISTS pob_exists_barang_kode//
CREATE TRIGGER pob_exists_barang_kode BEFORE INSERT
ON `PURCHASE_ORDER_BARANG` FOR EACH ROW
BEGIN
    declare msg varchar(128);
    CREATE TEMPORARY TABLE kode_barang_tbl 
    SELECT ven.`KODE_BARANG` as kode_barang
    FroM  (
            SELECT po.`REQ_VENDOR_ID` as rvid
            FROM `PURCHASE_ORDER` po
            WHERE NEW.`PURCHASE_ORDER_ID` = po.`ID`
          ) `asdf`,
          `VENDOR_BARANG` ven
    WHERE ven.`VENDOR_ID` = asdf.rvid;
    
    SELECT po.`REQ_VENDOR_ID` as rvid
            FROM `PURCHASE_ORDER` po
            WHERE NEW.`PURCHASE_ORDER_ID` = po.`ID` INTO @rvid;
    
    
    IF NEW.barang_kode not in (SELECT kode_barang FROM kode_barang_tbl) THEN 
        set @errmsg = concat('Kesalahan! Tidak ada kode barang ', 
                          cast(new.barang_kode as char), 
                          ' pada vendor id ', 
                          cast(@rvid as char)
                        );
            DROP TEMPORARY TABLE kode_barang_tbl;
        signal sqlstate '45000' set message_text = @errmsg;
    END IF;
    
    DROP TEMPORARY TABLE kode_barang_tbl;
END;//

DELIMITER ;